BASH alias not working...
Colin Watson
cjwatson at ubuntu.com
Mon Jun 20 23:57:59 UTC 2005
On Mon, Jun 20, 2005 at 07:43:24PM -0400, Matthew S-H wrote:
> This is the code I added to my "~/.bashrc":
>
> ---START---
> alias "choose_to_edit"="cat /dev/null &&
> cd ~/Documents/ &&
> command ls | grep -n -v 'randomcraptonotmatch' | column &&
> echo 'Choose which one to edit:' &&
> read &&
> if test $REPLY -eq 1 ;
> then cat /dev/null &&
> echo 'test';
> fi"
> ---END---
>
> Before I continued any further with this script, I wanted to test to
> see if that worked. However, it didn't...
>
> It gives we the following error:
> -bash: test: -eq: unary operator expected
You should quote "$REPLY" thus so that it expands to an empty word
rather than disappearing altogether if it's empty. You should probably
also use = rather than -eq so that test does string matching and
therefore doesn't complain about non-numeric arguments.
Cheers,
--
Colin Watson [cjwatson at ubuntu.com]
More information about the ubuntu-users
mailing list