[ale] BASH question

John Pilman jcpilman at gmail.com
Sun Jun 26 15:58:16 EDT 2011


I want to write a shell script or alias to allow me to cd to a
particular directory more easily.

When I plug in a flash drive, it gets mounted automatically in
/media/102B-1B76, only the last nine characters are not always the
same.  Since usually there is only one directory in /media I want a
command that will cd to that directory.

I tried
/media$ find . -mindepth 1 -type d -prune|sed 's:./::'|xargs cd
but I get
xargs: cd: No such file or directory
however
/media$ find . -mindepth 1 -type d -prune|sed 's:./::'
returns
102B-1B76

I have also tried the -print0 option, but without further success.
Any ideas?
...John


More information about the Ale mailing list