Sponsored Content
Top Forums Shell Programming and Scripting Passing argument from one script to other Post 87755 by Gerry405 on Thursday 27th of October 2005 11:17:49 AM
Old 10-27-2005
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 12:43 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Passing argument to awk script

I am writing a shell script. Now i need to read in a string and send it to an awk file to compare and search for compatible record. I wrote it like tat: read serial | awk -f generate.awk data.dat p/s: the data file got 6 field. According to an expert, we can write it like tat: read... (1 Reply)
Discussion started by: AkumaTay
1 Replies

2. Shell Programming and Scripting

Problem when passing argument to a shell script

Hi all, I'm new to Shell scripting. In my shell script for Bourne shell, the script accepts a date parameter which is optional. If the value is supplied, the supplied value should be assigned to a variable. If not, the current date will be assigned to the variable. My script is like this. #!... (9 Replies)
Discussion started by: sumesh.abraham
9 Replies

3. Shell Programming and Scripting

Need to run the script by argument passing

Hi All, I have a question regarding running this script by passing an argument, for example ./ShellParse.sh sun, how do i do that? So i want when i pass argument sun, it shouild execute things inside the for loop. I want to support some other platforms too, so there are more for loops to... (3 Replies)
Discussion started by: asirohi
3 Replies

4. Shell Programming and Scripting

Its Urgent ::: Passing Argument during Script Execution

Dear All, Plz, can someone clarify me regarding the below. Actually I want to write the script that will get the some parameter like "yes" or "No" as we wish during execution without prompting for entering that word. Plz tell me... Its Urgent.. Thanks & Regards ... (1 Reply)
Discussion started by: ks47
1 Replies

5. Shell Programming and Scripting

Passing argument to a script while executing it within current shell

Hi Gurus, I have written a script set_env.ksh to which I pass an argument and set the oracle login credentials based on the argument I pass. The script has code as below. ORACLE_SID=$1 DB_SCHEMA_LOGON=$DB_SCHEMA_USER/$DB_SCHEMA_PASSWORD@$ORACLE_SID; export DB_SCHEMA_LOGON; echo... (3 Replies)
Discussion started by: Sabari Nath S
3 Replies

6. Shell Programming and Scripting

Passing value as a command line argument in awk script.

I have one working awk command line. Which taking data from the “J1202523.TXT” file and generating the “brazil.dat” file. PFB code. awk '{ DUNS = substr($0,0,9);if ( substr($0,14,3) == "089" ) print DUNS }' J1202523.TXT > Brazil.dat But now I want to pass two parameter as a command line argument... (4 Replies)
Discussion started by: humaemo
4 Replies

7. Shell Programming and Scripting

Passing --usage as argument to awk script

I have the awk script below and things go wrong when I do awk -v dsrmx=25 -f ./checkSRDry.awk --usage I basically want to override the usual --usage and --help that awk gives. How do people usually handle this situation when you also want to supply your own usage and help concerning the... (2 Replies)
Discussion started by: kristinu
2 Replies

8. Shell Programming and Scripting

Passing argument from Java to Shell script

Hi All, I want to pass array of argument from Java to a shell script.I can use process builder api and its exec() method to call the script,but the question is how to receive the parameter in the script. Thanks in advance ---------- Post updated at 10:00 PM ---------- Previous update was... (1 Reply)
Discussion started by: Abhijeet_Atti
1 Replies

9. Shell Programming and Scripting

passing argument in script?

hi, I want to implement some function to perform following task if ; then $TEXT = "Data_0" else $TEXT = $1 fi if ; then $Lines = 45 else $Lines = $2 fi Kindly suggest, thanks (11 Replies)
Discussion started by: nrjrasaxena
11 Replies

10. Shell Programming and Scripting

Passing variable as an argument to another script

Hi, I am trying to pass a variable as an argument to another script. While substitution of variable, I am facing a problem. varaiable "a" value should be -b "FPT MAIN". When we pass "a" to another script, we are expecing it to get substitue as ./test.sh -b "FPT MAIN". But, it is getting... (9 Replies)
Discussion started by: Manasa Pradeep
9 Replies
setuid(2)							System Calls Manual							 setuid(2)

NAME
setuid - Sets the user ID SYNOPSIS
#include <unistd.h> int setuid ( uid_t user_id ); Application developers may want to specify an #include statement for <sys/types.h> before the one for <unistd.h> if programs are being developed for multiple platforms. The additional #include statement is not required on Tru64 UNIX systems or by ISO or X/Open standards, but may be required on other vendors' systems that conform to these standards. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: setuid(): XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the new user ID. DESCRIPTION
The setuid() function sets the real user ID, effective user ID, and the saved set user ID to the user_id parameter. To change the real user ID, the effective user ID, and the saved set user ID, the calling process must have superuser privilege. If the process does not have appropriate privilege, but the user_id parameter is equal to the real user ID or the saved set user ID, the setuid() function sets the effective user ID to the user_id parameter. The real user ID and saved set user ID remain unchanged. RETURN VALUES
Upon successful completion, the setuid() function returns a value of 0 (zero). Otherwise, the function returns a value of -1 and sets errno to indicate the error. ERRORS
The setuid() function sets errno to the specified values for the following conditions: [Tru64 UNIX] The process is attempting an operation that would exceeds a system limit, such as the number of tasks or threads allowed for a user ID. The value of the user_id parameter is invalid. The process does not have superuser privileges, and the user_id parameter does not match the real user ID or the saved set user ID. RELATED INFORMATION
Functions: exec(2), getuid(2), setgid(2), setreuid(2) Standards: standards(5) delim off setuid(2)
All times are GMT -4. The time now is 10:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy