Hi,
This script receive in input 2 parameters, the use $2 in this way:
switch ($2)
case r:
p=r--
echo $2 ok
breaksw
case rw:
p=rw-
echo $2 ok
breaksw
case rwx:
p=rwx
echo $2 ok
breaksw
default
echo Errore, secondo parametro errato
#exit 0
endsw
Why I have the error???:
./script: line 1: syntax error near unexpected token `$2'
./script: line 1: `switch ($2)'
I followed this guide:
switch ( str )
case string1:
commandlist1
breaksw
case string2:
commandlist2
breaksw
default
commandlist
endsw
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
You can try:
which works on most systems, provided that csh is installed and is in your path.
However, in order to execute the file as a command like:
you'll need the first line to contain the absolute path to csh, and to set the execute permission on the file. For the first part, enter at the command line:
On my system, this returns:
Then make the first line of your script:
or whatever the whereis command returns. (The first line in a script is very special. It looks like a comment, but it actually supplies the direct path to the program that is to process the script. The first line is called the shebang line.)
If whereis cannot find csh, then either you'll need to install it -- if csh is a requirement for the class -- or you'll need to learn to write the script in bash (or some other Bourne shell family shell).
If all else fails, perhaps you need to chat with the prof.
Hi,
I've put the correct root password but why do I get this below?
huamin@SOL11I:~$ su
Password:
su: Sorry
huamin@SOL11I:~$
Many Thanks & Best Regards,
HuaMin (16 Replies)
Hi
I had an active passive cluster. Node A went down and all resource groups moved to Node B.
Now we brought up Node A. What is the procedure to bring everything back to Node A.
Node A #lssrc -a | grep cl
clcomdES clcomdES 323782 active
clstrmgrES cluster... (9 Replies)
Howdy, I'm trying to tar a bunch of files into their own individual tar archives. In other words i have files a.txt thru z.txt and i want to create a.tar thru z.tar in the same folder. I've been using -T to read in the list of files to be archived but i can't get it to work. I think my problem is... (5 Replies)
hi,
how to access console of a switch having rj45 on switch side to db 9 female on pc side console cable which needs to be connected to one console server having rj11 on its side and db 9 female on other end.i.e. on switch side,console cable has rj45 and db 9 pin female connector on other side of... (1 Reply)
Guys,
I need to copy files from source to destination with datetime preserved
I did it with cp -p <source>/file <destinaltion>/file
But when I do stat command on copied file , it seems the copied file has "change time" modified.
Please guide me in understanding (2 Replies)
Hi All,
Could anybody please explain to me, why this piece of code compiles.
void duff(register char *to, register char *from, register int count)
{
register int n=(count+7)/8;
switch(count%8){
case 0: do{ *to++ = *from++;
case 7: *to++ = *from++;
case... (2 Replies)
using switch can we match for more than one values..
eg:
switcha(a)
{
case 1, 2, 3: printf("ddd");
break;
case 4, 5, 6: printf("mmm");
break;
}
In this case wat i found was only for the last value, i.e 3 and 6 the switch works.
... (12 Replies)
hi,
i am try to run following script in c-shell, using switch command.
#!/bin/csh
choice=0
while
do
echo "system monitor"
echo "
1) system paging
2) system file inf.
3) system disk inf.
9) exit
"
echo "select an option: \c"
read choice
case $choice in
1)... (3 Replies)