Jump to content

Need Help In Unix Please


massmaharaj

Recommended Posts

[quote name='massmaharaj' timestamp='1325676429' post='1301237594']
oka script run chesinappudu . aa script lo second script pedthe second dhi kuda run kaavali
[/quote]

serial ga pettukuntu vellu anni run avutai...

Link to comment
Share on other sites

[quote name='massmaharaj' timestamp='1325676429' post='1301237594']
oka script run chesinappudu . aa script lo second script pedthe second dhi kuda run kaavali
[/quote]

[font="helvetica, arial, sans-serif"][color="#282828"]first script lo [/color][/font]
[color=#282828][font=helvetica, arial, sans-serif]./scriptpath/se[/font][/color][color=#282828][font=helvetica, arial, sans-serif]criptname.sh[/font][/color]

[color=#282828][font=helvetica, arial, sans-serif]ani ivvu [/font][/color]

Link to comment
Share on other sites

cat ${TGT_FILE_PATH}/${DATA_FILE} > ${TGT_FILE_PATH}
[color=#282828][font=helvetica, arial, sans-serif]/path/to/2.sh[/font][/color]



[font="helvetica, arial, sans-serif"][color="#282828"]for this 2.sh has r[/color][/font]m -f ${TGT_FILE_PATH}/servicing.dat


will the above two lines correct

Link to comment
Share on other sites

[color=#282828][font=helvetica, arial, sans-serif]cat ${TGT_FILE_PATH}/${DATA_FILE} > ${TGT_FILE_PATH}[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]/path/to/2.sh[/font][/color]


[color=#282828][font=helvetica, arial, sans-serif]script location : download/infa/scripts[/font][/color]

Link to comment
Share on other sites

[quote name='massmaharaj' timestamp='1325676429' post='1301237594']
oka script run chesinappudu . aa script lo second script pedthe second dhi kuda run kaavali
[/quote]

oka script ni call cheyyataniki inkoti deniki...informatica ayite post session command lo sh /x/x/x/filename iste aa script execute avuddi...ala nuvvu enni kavalante ani call chesukooo :)

Link to comment
Share on other sites

idhoka chaala simple example ( assuming script1.sh and script2.sh are in the same directory )

script1.sh
--------------

#!/bin/bash
. ~/.bash_profile
my_name=kiss4amiss
source script2.sh #############Calling script2.sh##########

script2.sh
-------------

echo $my_name

-------------------------------------------------------------------------------------------------------------------

If you execute it by sh script1.sh, the output would be kiss4amiss


there are actually 2 ways to call a sub script from with in a script ( as far as I know )
(1) sh script2.sh ( or ./script2.sh )
(2) source script2.sh

sh script2.sh: If you call a subscript from a script using sh <subscriptname>, the parent script variables will NOT be passed on to the subscript. I mean to say the scope of the variables in the parent script is limited to parent scirpt itself.

source script2.sh: If you cal subscript using 'source' command, the scope of the variables in parent script is in the parent script and inside the subscript too.

Link to comment
Share on other sites

[sub]Thank you Each and every one Thank you all for you suggestions Thanks once again [/sub]with your suggestions i have completed my task which were given to me



Thanks All
Peru peru ki Thanks
Pavan

Link to comment
Share on other sites

Oka vela first set of commands successful gaa execute ayaka ne second script call cheyali ante ila cheyochhu.. and ikkada file path ante second script full path ivvali..

#! /usr/bin/sh
######## Main Script ###########
set
of
commands
for
the
first
script

if [ $? -eq 0 ]; then

echo "Successful, calling the second script"
FILE_PATH="/home/dir"
script_name="script2.sh"

${FILE_PATH}/${script_name}

else

echo "Error occurred while executing the first commands"

fi

################# End of Script #######################

Link to comment
Share on other sites

×
×
  • Create New...