Tuesday, March 23, 2010

List Directories | See Script | Word-length script | Safe Copying

#!/bin/sh
for file in $*
do
  if [ -d $file ]
  then
     ls $file
  fi
done
--------------------------------------
#!/bin/sh
for file in $*
do
  if [ -d $file ]
  then
     echo "using ls"
     ls $file
  else
     more $file
  fi
done
-----------------------------------------------
#!/bin/sh
echo "Type a word"
read word
echo $word is $(echo -n $word | wc -c) letters long
echo or $word is ${#word} letters long
------------------------------------------------
#!/bin/sh
if [ -f $2 ]
then
        echo "$2 exists. Do you want to overwrite it? (y/n)"
        read yn
        if [ $yn = "N" -o $yn = "n" ]
        then
            exit 0
        fi
fi
cp $1 $2

1 comment: