in my ~/.bash_aliases
i have a function:
function fresh() {
if [ $# -eq 0 ] ; then
# If no params added, source both bash_aliases and aliases.zsh
"cp $HOME/.bash_aliases $ZSH_CUSTOM/aliases.zsh; source $HOME/.bash_aliases $ZSH_CUSTOM/aliases.zsh; echo 'Aliases Refreshed (Bash + Zsh).'"
return 0
fi
CMD=$1
shift
case $CMD in
b|bash)
# Source bash_aliases (only)
"source $HOME/.bash_aliases; echo 'Aliases Refreshed (Bash).'"
;;
z|zsh|zash)
# Source aliases.zsh (only)
"source $ZSH_CUSTOM/aliases.zsh; echo 'Aliases Refreshed (Zsh).'"
;;
esac
return $?
}
The default fresh
w/no args makes a copy of ~/.bash_aliases
and just renames it to aliases.zsh
, and then sources both files.
It worked fine as an actual alias, but moving it to a function I now get this:
fresh:4: no such file or directory: cp /home/scott/.bash_aliases /home/scott/.oh-my-zsh/custom/aliases.zsh; source /home/scott/.bash_aliases /home/scott/.oh-my-zsh/custom/aliases.zsh; echo 'Aliases Refreshed (Bash + Zsh).'
If I literally copy and paste each command from it, they work:
and changes confirmed by doing a cat $ZSH_CUSTOM/aliases.zsh
and looking for the changes.
Any idea why it's complain that one of the files or dirs isn't found? Do I need to cd
to some dir first? (seems like I shouldn't have to?)