desktop clearning

Owen Townend bowbowbow at optushome.com.au
Fri Nov 16 14:43:26 UTC 2007


On Fri, 2007-11-16 at 11:03 +0530, Shibu C Varughese wrote:
> 
> 
> On 11/16/07, Shali 9846303531 <shalib2 at gmail.com> wrote:
>         
>         Dear sir,
>         
>         when i am trying to executing the script the following error
>         will come ,what is this sir,
>         
>         #!/bin/sh
>         cd </home/shali/Desktop/dclearn> 
>         dir=$(mktemp -d -p /tmp)
>         mv < 2.cpp 3.java> $dir   
>         rm -r ./*
>         mv $dir/* .
>         rmdir $dir
>         
>         
>         error
>         
>         ./desktopclearning.sh
>         ./desktopclearning.sh: line 3: syntax error near unexpected
>         token `newline'
>         ./desktopclearning.sh: line 3: `cd
>         </home/shali/Desktop/dclearn> ' 
>         
>         
>         
>         
>         -- 
>         Shali.K.R
>         Asst.Librarian(Digital)
>         Vidya Academy of Science & Technology
>         Thrissur, Kerala.
>         Mob:9846303531 
>         --
>         hi ...
> 
> Check how may files you have on your desktop ... 
> ls -l |grep -v d|wc -l
> 
> 
> Create backup of your files, before you remove them ," ls -l |grep -v
> d " will give you the file list.
> it's simple you can do that...
> -- 
> shibucv at itmission.org
> True greatness is measured by how much freedom you give to others, not
> by how much you can coerce others to do what you want. --Larry Wall 

Hey,

`grep -v d` will exclude any string with a 'd' in it... you would be
better using `grep -v ^d` for a starts-with-d exclusion to cut
directories. **

  On the original issue, `cd </home/shali/Desktop/dclearn>` is your
problem, take out the < & > characters. They were added to the
description given to you as they are a convention in help files and
command examples. Anything between <> is needed, anything between [] is
optional, anything with '...' after it can be repeated. E.g. this from
the unrar man page:

unrar  <command> [-<switch 1> -<switch N>] archive [files...] [path...]
^---^program name
	^------^ need a command flag
		 ^-switches are optional-^
					   ^ Archive to operate on
etc..

I'm not sure where this convention is documented, perhaps `man man`.

cheers,
Owen.


**
An extract of the relevant section of the Grep Manual:

"
The  caret ^ and the dollar sign $ are metacharacters that respectively
match the empty string at the beginning and end of a line.  The symbols
\<  and \> respectively match the empty string at the beginning and end
of a word.  The symbol \b matches the empty string at  the  edge  of  a
word,  and \B matches the empty string provided it’s not at the edge of
a word.
"





More information about the ubuntu-users mailing list