BASH alias not working...
byronsalty at gmail.com
Tue Jun 21 00:06:05 UTC 2005
Hmm... my first inclination is to break this complex logic into a
shell script. I have a /bin directory in my /home directory which I
put personal scripts in. Just add that directory to your path.
You could put this whole thing into a script called something like
choose_to_edit.sh and make sure that script is executable.
I'd also put all the commands you want to run on separate lines and
check the exit value of the important ones with $? instead of putting
them all on one line with &&.
Making a standalone script and putting the commands on different lines
will make it easier to debug. Also, if you have the script on your
path I know you can tab complete it, not sure about aliases.
On 6/20/05, Matthew S-H <mathbymath at aol.com> wrote:
> This is the code I added to my "~/.bashrc":
> 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';
> 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
> What am I doing wrong?
> Any help would be appreciated.
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
More information about the ubuntu-users