The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Argument passing using for or while loop jisha Shell Programming and Scripting 4 04-09-2008 12:21 AM
passing argument into awk prkfriryce Shell Programming and Scripting 4 02-01-2007 04:44 PM
Problem when passing argument to a shell script sumesh.abraham Shell Programming and Scripting 9 12-13-2006 12:07 PM
Passing Argument to Function AkumaTay UNIX for Dummies Questions & Answers 2 10-18-2001 06:24 PM
Passing argument to awk script AkumaTay UNIX for Dummies Questions & Answers 1 08-03-2001 11:12 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-06-2004
lloydnwo lloydnwo is offline
Registered User
  
 

Join Date: Sep 2004
Posts: 13
Passing argument from one script to other

Dear All,

I have one script which accepts database name and user_id from the user, i have another script that will unload the data from all the tables based on the user_id accepted by the user. How can i pass the user_id from the 1st script to the other. My OS is sun solaris. Thanks in advance.

Regards,

lloyd
  #2 (permalink)  
Old 10-06-2004
S.P.Prasad S.P.Prasad is offline
Registered User
  
 

Join Date: Jan 2002
Location: India
Posts: 111
Out of multiple ways one way is to invoke the second script by providing the user_id as an command line argument to the script from the first script. Something like

#code of first script to take input of user_id and password

Second_script_name $user_id


In the second script use positional parameters to determine the value associated for the first argument:

UserId=$1


I hope this helps.
  #3 (permalink)  
Old 10-27-2005
Gerry405 Gerry405 is offline
Registered User
  
 

Join Date: Jun 2005
Location: Alexandria, Scotland
Posts: 46
trouble with passing variables from script to script

I have tried this as suggested, but it does not work for me, below is what I thought would work, but it does not even stop at the sleep 3000 part, I know it is because of the ftp part but don't know how to solve as I tried it without FTP and it works a treat


#! /usr/bin/ksh
Name=`who am i | cut -f1 -d" "`
TTY=`who am i |awk '{print $2}'`
IpAdd=`finger -l |( grep $TTY )| awk '{ print $9 }'`
HOST=$IpAdd
echo "\n\t please enter in the name of the file thats in your uploads folder ! \c"
read FileName
USER=W21?."453
PASSWD=******
DIR=/uploads
exec 4>&1
ftp -nv >&4 2>&4 |&
print -p open $HOST
print -p user $USER $PASSWD
print -p cd c:\
print -p dir c:\uploads
print -p binary
print -p get $DIR/$FileName /u1/excel/SplitF/$FileName
print -p bye
wait
/u1/excel/SplitF/FileSplitter $FileName ##### your suggested code
exit
bye
...............................................................................

2nd script

#! /bin/sh
rm /u6/SplitFiles/*.?? > /dev/null
echo $1
sleep 30000

because I can't get the variable from the 1st to the 2nd script I have to prompt for input within the second script again

ie ....
echo " Choose from the list above the file you wish to split ... \c"
read FileName

and when I done with splitting, I then have to prompt again for the new created file's
output.aa ouput.ab etc...etc..
any help would be great!
















Quote:
Originally Posted by S.P.Prasad
Out of multiple ways one way is to invoke the second script by providing the user_id as an command line argument to the script from the first script. Something like

#code of first script to take input of user_id and password

Second_script_name $user_id


In the second script use positional parameters to determine the value associated for the first argument:

UserId=$1


I hope this helps.

Last edited by Gerry405; 10-27-2005 at 11:43 AM..
  #4 (permalink)  
Old 10-27-2005
supaphat supaphat is offline
Registered User
  
 

Join Date: Oct 2005
Posts: 22
Question

Here's a link to automate ftp stuff...i posted it earlier - dont know if it was this site or another..It may help in whatever is hanging the program.

Auto FTP info.
Closed Thread

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0