Accessing my Droid Maxx from a shell script
Karl Auer
kauer at biplane.com.au
Tue Dec 29 09:18:59 UTC 2015
On Tue, 2015-12-29 at 00:23 -0800, MR ZenWiz wrote:
> indir=$DevicePath/'Internal\\ storage' ### This never works
> ls $indir
Simplest is to wrap up anything with spaces (or that could contain
spaces) in double quotes. Those two lines should be:
indir="$DevicePath/Internal storage"
ls "$indir"
Try this script. Cut and paste this into a file, use chmod to make it
executable, and execute it.
#/bin.sh
echo "~~~~ making a temp dir for our experiments ~~~~"
TEMP=test.$$
mkdir $TEMP
echo "~~~~ changing to the temp directory ~~~~~"
cd $TEMP
echo -n "We are now in "
pwd
DIR="two part"
echo "Our \$DIR variable now contains: $DIR"
echo "~~~~ try to make a directory with that name - oops! ~~~~"
mkdir $DIR
ls -la
echo "~~~~ deleting directories "two" and "part" ~~~~"
rmdir two
rmdir part
echo "~~~~ now try with \$DIR wrapped in quotes ~~~~"
mkdir "$DIR"
ls -la
echo "~~~~ now put put two files in it ~~~~"
touch "$DIR/this_file" "$DIR/that_file"
echo "~~~~ try to list the dir - oops! ~~~~"
ls -lad $DIR
echo "~~~~ try again with \$DIR wrapped in quotes ~~~~"
ls -lad "$DIR"
echo "~~~~ cleaning up ~~~~"
rm "$DIR/this_file" "$DIR/that_file"
rmdir "$DIR"
cd ..
rmdir $TEMP
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389
GPG fingerprint: 3C41 82BE A9E7 99A1 B931 5AE7 7638 0147 2C3C 2AC4
Old fingerprint: EC67 61E2 C2F6 EB55 884B E129 072B 0AF0 72AA 9882
More information about the ubuntu-users
mailing list