![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 |
|
||||
|
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. |
|
||||
|
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:
Last edited by Gerry405; 10-27-2005 at 11:43 AM.. |
|
||||
|
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. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|