SunQuest
           UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old November 29th, 2003, 10:58 PM
rsmith6 rsmith6 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 13 rsmith6 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
simple shell problem

i am in the process of creating a simple shell written in c and used in unix. i have covered all my basis including pipes, redirection. etc. but i am having difficulty with environmental variables and variable substitution. the assignment requests:

builtin functions:
set [ <name> <value> ]
unset <name>
setenv [ <name> <value> ]
unsetenv <name>

getshv(<name> ) that acts like getenv(3c)
putshv(<name>,<value> ) that acts like putenv(3c)
and use an external shvar that acts like environ
char *shvar[];
with up to 1024 shell variables, as determined by:
#define NSHVAR 1024

variable sub:
Only ${<name>} or ${<digit>} required

You can, if you wish, do $PATH or $1 also.

Substitution can be anywhere in a command line including a whole line:

set mycmd “ls –l *.c”



è ${mycmd}



$(digit) positional parameters like $0 $1 $2 ...

These are the arguments passed to your shell program from the argv[] array.

mysh -f a b c

-> echo ${0}

mysh

-> echo ${1}

-f

-> echo ${2}

a

-> echo ${#}

5


any help that anyone could give me in coding this would be appreciated. thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > simple shell problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway