LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   shell script help (https://www.linuxquestions.org/questions/linux-newbie-8/shell-script-help-315937/)

vishamr2000 04-22-2005 12:42 AM

shell script help
 
Hi to all,

I badly need some help with this. How do I write a shell script version of some C code I wrote? The basic idea is as follows:

variable x is given the value of 1 at start in script. When it goes down the function, I want it to retain the value at which the program terminated when it first ran so that when the program runs a second time, it takes the last value that x got assigned (that is either a 0 or a 1).

if(x==1)
{

printf("Good Morning!!");
x=0;
}

else
if(x==0)
{

printf("Good Afternoon!!");
x=1;
}

Thx in advance..
Regards,
Visham

twantrd 04-22-2005 01:11 AM

Can you show us what you have attempted so far? If you paste it here, we'll help but we're not going to write this up for you. This is a very very very simple script. If you don't know where to start, start here:

http://pegasus.rutgers.edu/~elflord/unix/bash-tute.html

-twantrd


All times are GMT -5. The time now is 03:22 AM.