Please help me validate script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Please help me validate script
# 1  
Old 05-23-2012
Please help me validate script

Hi Guys,

Im a newbie to scripting and have a small assignment. can someone please confirm if the script i have written would work fine as we dont have a test server to test Smilie

Scenario - copy 2 files from an ftp server (windows) to a linux machine (a perticular folder). run 2 different scripts (one after the other) on the 2 files to produce output files and then copy the output files into a different dir. Hope its not too complex.

here is my script.
Code:
#!/bin/bash
HOST='machine'
USER='user'
PASSWD='password'
ftp -i -n $HOST
user ${USER} ${PASSWD}
binary
cd /home/nishant
get file1
get file2
exit (from the ftp server)
script1.sh >log.log
if test "$?" != "0"; then exit 1; fi
script2.sh >log.log
if test "$?" != "0"; then exit 1; fi
cp output1 /home/nishant/done
cp output2 /home/nishant/done
exit

Moderator's Comments:
Mod Comment How to use code tags


---------- Post updated at 07:53 AM ---------- Previous update was at 07:32 AM ----------

Hi Mod,

Not sure if my post needed tage though. Anyways, i am typing the code again with the tags.

Code:
#!/bin/bash
HOST='machine'
USER='user'
PASSWD='password'
ftp -i -n $HOST
user ${USER} ${PASSWD}
binary
cd /home/nishant
get file1
get file2
exit (from the ftp server)
script1.sh >log.log
if test "$?" != "0"; then exit 1; fi
script2.sh >log.log
if test "$?" != "0"; then exit 1; fi
cp output1 /home/nishant/done
cp output2 /home/nishant/done
exit

---------- Post updated at 07:55 AM ---------- Previous update was at 07:53 AM ----------

donno. didnt work may be Smilie

Last edited by Franklin52; 05-23-2012 at 09:48 AM.. Reason: Please use code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to validate header in a csv file

Hi All; I am struggling to write a script that validates file header. Header file would be like below with TAB separated TRX # TYPE REF # Source Piece Code Destination Piece Code every time I need to check the txt file if the header was same as above fields if validation success... (6 Replies)
Discussion started by: heye18
6 Replies

2. Shell Programming and Scripting

Shell Script to validate the access for Servers

Hi Experts, Please advise to Write a Shell script, To check , whether the user has access to UNIX PRODUCTION server or not? If no, then need to provide the access to UNIX PRODUCTION server and then need to provide access to print only few FILES. After connecting to ther server, again... (5 Replies)
Discussion started by: vasuvv
5 Replies

3. Shell Programming and Scripting

Script to validate dates inside a file

Hi All, Looking forward a script with below requirement.Please let me know if any pointers. - there is a file which contains date - script will go inside the file and validate date is T-1 and for Friday T-3 - Send email with status -Shell is Ksh (2 Replies)
Discussion started by: dattatraya
2 Replies

4. Shell Programming and Scripting

Script which will validate SSL cert with key

Hi, I am trying to find the script which will ask for SSL Cert and Key file name/path. The output of both should be matched and compared. If the output are same than the script final output should be Certificate Matches and if it doesn't than Output don't match. Is there any way we can create... (0 Replies)
Discussion started by: SachinD
0 Replies

5. AIX

Script to validate between two environments

Hi, I trust that you are well - I'm a bit new into AIX and I've been assigned a task to write a script that will always validate between our two Prod (Prod A and Prod B) environments to confirm which prod we live at. The two environments are exact replicas and this check I need to put in... (5 Replies)
Discussion started by: Twaggzk
5 Replies

6. Shell Programming and Scripting

Need script to validate file according to date

Hi All, I am very new to unix and just started to work with unix and shell scripting.I have a query anyone help would be much appreciated I am using sun solaris OS I want to validate a file according to its date and if validate successful then it would write the file name,size,date and... (3 Replies)
Discussion started by: sv0081493
3 Replies

7. Shell Programming and Scripting

Script to validate file header and trailer

Hi, I need a script that validates a file header/detail/trailer. File layout is: Header - Rec_Type|File_name|File_Date Detail - Rec_Type|field1|field2|field3... Trailder - Rec_Type|File_name|File_Date|Record_count Sample Data: HDR|customer_data.dat|20120709... (7 Replies)
Discussion started by: ash_sh
7 Replies

8. Shell Programming and Scripting

How to Create LOG and Validate for this Script

Hi all, This is my Script #!/bin/bash current_date=`date +%d-%m-%Y_%H.%M.%S` Date=`date +%d%m%Y` Lfriday=`date +%d%m%Y -d last-friday` RootPath=/var/domaincount/com mysql zonefile<<EOFMYSQL CREATE TABLE com$Date(domain VARCHAR(255),col2 VARCHAR(255),col3 VARCHAR(255),col4... (10 Replies)
Discussion started by: anishkumarv
10 Replies

9. Shell Programming and Scripting

Script creation(How to validate SID?)

I was going write a script from following site. Unix Shell Script to Execute Oracle SQL Query (link removed) My configuration setting for oracle XE. export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server export PATH=$PATH:$ORACLE_HOME/bin export ORACLE_SID=XE but after... (4 Replies)
Discussion started by: pinga123
4 Replies

10. Shell Programming and Scripting

Validate BASH script before running it...

Hello, Is there some way to validate a bash script before running it. I want to make sure all of the syntax and everything is good so that I dont get a false return code. Thanks, tom (7 Replies)
Discussion started by: tjones1105
7 Replies
Login or Register to Ask a Question