[ale] command doesn't work from script, only command line...

Steven A. DuChene linux-clusters at mindspring.com
Sat Dec 8 15:15:33 EST 2001


On Sat, Dec 08, 2001 at 10:58:45AM -0500, Christopher Bergeron wrote:
> Does anyone know why this command:
> 
> cd `history | grep cd | grep -v grep | tail -n 2 | tail -n 1 | tr -s " " |
> cut -f 4 -d " "`
> 
> works from the command line, but not from a [verbatim] shell script:
> #!/bin/bash
> cd `history | grep cd | grep -v grep | tail -n 2 | tail -n 1 | tr -s " " |
> cut -f 4 -d " "`
> 
> I just named it p (for Previous) so I can switch to the directory I just
> came from.  It doesn't work though.  Any suggestions?
> 

You do realize this feature already exists in bash don't you? If i am in
oh, say /usr/src/linux/drivers/sound and then I cd to /etc to check something
I can get back to where I was by doing "cd -"   That puts me back in
/usr/src/linux/drivers/sound
-- 
Steven A. DuChene      linux-clusters at mindspring.com
                      sduchene at mindspring.com

        http://www.mindspring.com/~sduchene/

---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list