Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
could any one of u help me in solving this problem
*********please the deadline is tomorrow*******
Write a shell script (give it the name: skinny) which receives any number of arguments. Those arguments are in fact themselves Unix commands (e.g. cat, cp, mv, clear, ls,...).
Once invoked, it shall display a prompt like this:
Skinny Shell>
And shall only allow the user to execute the Unix commands received as arguments. If a command which is not among those arguments is entered, it should be ignored and an error message shall be printed on the screen. If the command is among the list of arguments, then it shall be executed. In all cases the above prompt shall be always echoed.
To exit, we shall just type: quitthanx

I shouldn't do this, but here's the hard part - the loop. I'll leave it to you to make the comparison:
#!/bin/ksh
echo "your prompt"
read command
cnt=0
for i in $*
do
if [[ $i = $command ]]
then
cnt=1
break
fi
done
echo $cnt

thanks for ur help
please solve cause i still have two problems and i am working with them now and its 9:30 pm and there is no time
pleeeeeeeeeeeeeeeeeeeeeese

i couldnt do more than this
please help me
echo -n " Skinny Shell>"
a= `line`
for i in $*
doif [ $i = a ]
then./exec.txt a
break
elif [ a = " quit " ]
thenkill (i dont know what i have to put here)
else
echo "not available"
f
i
done

Your requirements are not very clear.
#!/bin/ksh
while true
do
printf "Skinny Shell > "
read command
if [ "$command" = "quit" ]
then
break
ficnt=0
for i in $*
do
if [[ $i = $command ]]
then
cnt=1
break
fi
done
if [ $cnt -eq 1 ]
then # execute the command if valid unix
printf "Executing valid command\n"
eval $*
else
printf "Invalid command\n"
fi
don

Here is a sample output from my skinny shell script:
mona@amazon:~/spring2006/os470> skinny date pwd ls cal
Skinny Shell> ls
a1q1 execCommand getFirst lab1 lab2 skinny
Skinny Shell> cal 3 2006
March 2006
S M Tu W Th F S
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31Skinny Shell> date
Wed Mar 8 16:33:31 GST 2006
Skinny Shell> pwd
/staff/mona/spring2006/os470
Skinny Shell> cat skinny
Command not available!
Skinny Shell> clear
Command not available!
Skinny Shell> bye
Command not available!
Skinny Shell> quit
mona@amazon:~/spring2006/os470>
In the above execution, I only restricted the shell to the commands: date, pwd, ls and cal. Any other Unix –or non Unix- command will not be accepted

Hi!
I have installed sco unix 3.2v4.2 on Team Server (EISA - configuration M/C), I tried to add another scsi hdd, but it coutldn,t add properly and then my present os installation also get damage so reinstalled os. Pls. tell me proper method to do such old stuff.Regards,
Nivrutti.
(Email - nivruttisk@accelfrontline.in / nskesarkar@yahoo.com)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |