Here's the script:
Code:
#! /bin/bash -x
if [ -n $1 ]; then
cd /home/gabe/$1/ && ls
else
echo "Blah!"
fi
And here's what happens:
Code:
gabe @ tux ~ $ pwd
/home/gabe
gabe @ tux ~ $ ls amarok-svn/
MakeVars.in README config.h configure.in stamp-h1
Makefile acinclude.m4 config.h.in configure.in.bot subdirs
Makefile.am aclocal.m4 config.log configure.in.in
Makefile.am.in admin/ config.status* doc/
Makefile.cvs amarok/ configure* libtool*
Makefile.in autom4te.cache/ configure.files stamp-h.in
gabe @ tux ~ $ script amarok-svn
+ '[' -n amarok-svn/ ']'
+ cd /home/gabe/amarok-svn/
+ ls
MakeVars.in README config.h configure.in stamp-h1
Makefile acinclude.m4 config.h.in configure.in.bot subdirs
Makefile.am aclocal.m4 config.log configure.in.in
Makefile.am.in admin config.status doc
Makefile.cvs amarok configure libtool
Makefile.in autom4te.cache configure.files stamp-h.in
gabe @ tux ~ $ pwd
/home/gabe
So the directory exists, it tells me that it knows it exists, AND it will cd to it in the script and tell me the contents. Yet it always snaps back to the directory it's in when I start the script.