Skip to content

Instantly share code, notes, and snippets.

@brandonpittman
Last active December 5, 2016 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandonpittman/9d2432a60ed99c86e093086f6ce74524 to your computer and use it in GitHub Desktop.
Save brandonpittman/9d2432a60ed99c86e093086f6ce74524 to your computer and use it in GitHub Desktop.
Prepend function for Fish Shell
function prepend -d "Prepends argv[1] to argv[-1]"
set -l args $argv[2..-1]
set -l text "$argv[1]"
for arg in $args
echo '' > $arg
sed -i -e '1i\
'"$text" $arg
sed -i -e '$ {
/^$/d
}' $arg
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment