Made tail and head commands portable

This commit is contained in:
Nathan Broadbent
2011-10-20 08:07:19 +08:00
parent 046e4eecf7
commit a66a6d4d3f

View File

@@ -25,13 +25,13 @@ git_status_shortcuts() {
git status; return 1 git status; return 1
fi fi
# Fetch list of files from last line of script output # Fetch list of files from last line of script output
files="$(echo "$cmd_output" | tail -n 1)" files="$(echo "$cmd_output" | tail -n1)"
# Export numbered env variables for each file # Export numbered env variables for each file
local IFS="|" local IFS="|"
e=1; for file in $files; do export $git_env_char$e="$file"; let e++; done e=1; for file in $files; do export $git_env_char$e="$file"; let e++; done
# Print status # Print status
echo "$cmd_output" | head -n -1 echo "$cmd_output" | head -n-1
} }