Not able to display the value I am accepting as an argument


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Not able to display the value I am accepting as an argument
# 1  
Old 08-06-2007
Not able to display the value I am accepting as an argument

Hi,

I am new to UNIX. I am facing some problem here.

#! /usr/bin/ksh

currDate = $1
export currDate;
echo " Date is $currDate"

when I run this script, it says : currDate not found.

Can anybody point out the mistake please.

--mahek
# 2  
Old 08-06-2007
Hi Mahek

You just have to remove the spaces in the assignment of the variable:

#! /usr/bin/ksh

currDate=$1
export currDate;
echo " Date is $currDate"


Regards,

Erwin
# 3  
Old 08-06-2007
Code:
currDate = $1

There are no spaces in variable assignments:
Code:
currDate=$1

# 4  
Old 08-06-2007
thanks. It worked.

--Mahek
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Accepting search pattern to script argument

I have a script in tcsh and I want to have a find option to which I can pass a file search pattern I want using the command: /home/chrisd/tatsh/trunk/hstmy/bin/tcsh/raytrac.tcsh -f=*rc* The set command seems to fail when user does not supply a search pattern (if user just supplies -f, a... (2 Replies)
Discussion started by: kristinu
2 Replies

2. UNIX for Advanced & Expert Users

Error:--test: argument expected--Even though i give an argument.

Hi All, I am running the script VBoxManage list vms |sed 's/"//g' | cut -d " " -f1 > har1out.mytxt result=`cat har1out.mytxt | grep $1' echo $result echo $1 { if then echo pass else echo fail fi (2 Replies)
Discussion started by: harsha85
2 Replies

3. Shell Programming and Scripting

Accepting Input regardless of Case

Hi I am trying to get my script to accept input regardless if the person enters a or A. here is the portion of the code where I get the input. echo -n 'Please enter your choice:' # prompt user for input. read reply # read input echo case $reply in #... (2 Replies)
Discussion started by: DualPandas
2 Replies

4. Shell Programming and Scripting

Cannot compare argument in if statement in csh/grep command if argument starts with “-“

If ($argv == “-debug”) then Echo “in loop” Endif But this is not working. If I modify this code and remove “-“, then it works. Similarly I am getting problem using grep command also Grep “-debug” Filename Can someone please help me on how to resolve these... (1 Reply)
Discussion started by: sarbjit
1 Replies

5. Shell Programming and Scripting

Help with Accepting Directories as an Argument

I'm doing a script where you are suppose to start off in accepting one or more directory as an argument. How do i do this? Sorry for the nub question. (2 Replies)
Discussion started by: LinuxUser232331
2 Replies

6. Shell Programming and Scripting

Accepting A-Za-Z

Is there a way accept A-Za-z0-9 from the user from a parameter? EX. I want to take the parameter from the user even if its hEu or H3y and store it as a parameter ( $1 ) (18 Replies)
Discussion started by: puttster
18 Replies

7. Shell Programming and Scripting

reg accepting password

Hi, I want to login to many systems and password should be taken automatically from a file(login is working but password is not accepting). Any help on this is appreciable . My code. for i in `cat /tmp/tes ` ====>tes file contain list of hosts > do ssh $i > perl prog.pl >... (1 Reply)
Discussion started by: rogerben
1 Replies

8. UNIX for Dummies Questions & Answers

accepting input date

I how do i accept a input date in script which is lesser than a specified day? ex: to accept a date less than or equal to 100 days(from today).?:( Thanks for the help in advance.:) (1 Reply)
Discussion started by: abhi_123
1 Replies

9. Shell Programming and Scripting

get positive number n as argument script must calculate the factorial of its argument

Can someone please help me with this SHELL script? I need to create a script that gets a positive number n as an argument. The script must calculate the factorial of its argument. In other words, it must calculate n!=1x2x3x...xn. Note that 0!=1. Here is a start but I have no clue how to... (3 Replies)
Discussion started by: I-1
3 Replies

10. UNIX for Dummies Questions & Answers

How to find the last argument in a argument line?

How to find the last argument in a argument line? (4 Replies)
Discussion started by: nehagupta2008
4 Replies
Login or Register to Ask a Question