Last active
November 3, 2023 20:32
-
-
Save rodrigobdz/e80accf162872914e728d90e27a1452c to your computer and use it in GitHub Desktop.
Export fish abbreviations
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
#!/usr/local/bin/fish | |
# Use current date as name of file where fish | |
# abbreviations will be stored | |
# Format: YYYY-MM-DD | |
set -lx EXPORT_FILENAME (date "+%Y-%m-%d") | |
# Prepare destination fish script | |
echo "#!/usr/local/bin/fish" > $EXPORT_FILENAME.fish | |
# Write all abbreviations to file | |
abbr --show >> $EXPORT_FILENAME.fish | |
# Add missing "--add" parameter to each abbreviation | |
sed -i '' 's/abbr/& --add/g' $EXPORT_FILENAME.fish | |
# Make script containing abbreviations executable | |
chmod +x $EXPORT_FILENAME.fish |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Export abbreviations as fish script
By executing the resulting fish script, all abbreviations are added to the fish environment where the script is executed∫.
Requirements
Usage