Fix incorrect file extension for fish

This commit is contained in:
Manuel Thalmann 2024-03-25 18:07:40 +01:00
parent c02595a257
commit 694fac8edb
3 changed files with 8 additions and 7 deletions

View file

@ -5,7 +5,7 @@ pushd "${BASH_SOURCE%/*}" > /dev/null;
function addBashProfile() { function addBashProfile() {
name="$1"; name="$1";
title="$2"; title="$2";
addProfileStatement "$name" "$title" "/bin/bash" "/etc/bash/conf.d" "${@:3}"; addProfileStatement "$name" "$title" "/bin/bash" "sh" "/etc/bash/conf.d" "${@:3}";
} }
popd > /dev/null; popd > /dev/null;

View file

@ -5,7 +5,7 @@ pushd "${BASH_SOURCE%/*}" > /dev/null;
function addFishProfile() { function addFishProfile() {
name="$1"; name="$1";
title="$2"; title="$2";
addProfileStatement "$name" "$title" "/bin/fish" "/etc/fish/conf.d" "${@:3}"; addProfileStatement "$name" "$title" "/bin/fish" "fish" "/etc/fish/conf.d" "${@:3}";
} }
popd > /dev/null; popd > /dev/null;

View file

@ -2,11 +2,12 @@ function addProfileStatement() {
name="$1"; name="$1";
title="$2"; title="$2";
shellBin="$3"; shellBin="$3";
profileRoot="$4"; extension="$4";
profileRoot="$5";
if [ ! -z "${@:5}" ] if [ ! -z "${@:6}" ]
then then
statement="${@:5}"; statement="${@:6}";
else else
statement="$(cat)"; statement="$(cat)";
fi; fi;
@ -18,9 +19,9 @@ function addProfileStatement() {
echo '#!'"$shellBin"; echo '#!'"$shellBin";
echo "# $title"; echo "# $title";
echo "$statement"; echo "$statement";
} > "profile.sh"; } > "profile.$extension";
sudo install -Dm755 profile.sh "$profileRoot/$name.sh" sudo install -Dm755 profile.$extension "$profileRoot/$name.$extension"
popd > /dev/null; popd > /dev/null;
rm -rf "$contextRoot"; rm -rf "$contextRoot";