A simple shell alias to create commands
It's an alias that allows you to create another alias as a command to another command. Did you get it? No? Ok, take a look on how to use it.
You can install the fnfy alias using the install script:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/dapx/fnfy/master/install.sh)"
. ~/.functions # Load functions after install, or you can simply start a new shell session.
The syntax is very simple, first you pass the function name and after the command:
$ fnfy aliasname command and arguments
For example, you can use it to create any command like:
$ fnfy saymyname echo My name
$ saymyname
My name
or you can create an useful command like this:
fnfy svg2png inkscape \"\$1\" -b white --export-png=\"\$2\"
Pay attention to escape special characters. Thanks @jvns for the useful
svg2png
command!
Call the fns
alias to show the functions created:
fns
You can also compose with sort
to list all functions ordered by name:
fns | sort
Call the unfnfy
alias from any place passing the function name that you want to remove:
unfnfy aliasname
Remove the load entry from your rc file:
printf "%s\n" "g/^\. ~\/\.functions$/d" w | ed -s ~/.$(basename $SHELL)rc
And if you don't want to keep your functions:
rm ~/.functions