Last active
December 5, 2016 02:11
-
-
Save brandonpittman/9d2432a60ed99c86e093086f6ce74524 to your computer and use it in GitHub Desktop.
Prepend function for Fish Shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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