I can run,
svn status |grep -v .jasper$ |cut -d ' ' -f8 |sed '/.*\..*/!d' |xargs ls -altr --color=auto
just fine. But when I go to add this as an alias (alias svtr="...") I get an error saying...
-bash: !d': event not found
Any ideas?
Using backslash \
to escape your !
should work.
alias svtr="svn status |grep -v .jasper$ |cut -d ' ' -f8 |sed '/.*\..*/\!d' |xargs ls -altr --color=auto"
alias svtr
alias svtr='svn status |grep -v .jasper$ |cut -d '\'' '\'' -f8 |sed '\''/.*\..*/\!d'\'' |xargs ls -altr --color=auto'
Actually, that just eliminates the error, because inside ""
the shell tries to interpret !
.
you may want to revert quotes (i.e., use singlequote to define alias, and use doublequote inside the aliased command, and escape singlequotes where necessary.
The !d
in your sed
command is causing this, because !
is the Bash history expansion character. Temporarily turn off history expansion, like this:
set -H
alias svtr="..."
set +H
That should do it.