how to pass variables to s3cmd in a script file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to pass variables to s3cmd in a script file
# 1  
Old 08-09-2012
how to pass variables to s3cmd in a script file

Hi All,

How to pass the variable to s3cmd put command? I'm trying to use this command in a script as below:

Code:
s3cmd put ${upload_path} s3://${upload_dest}

where
Quote:
upload_path=/home/eng/test.file
upload_dest=mybucket/
With the above command in script, the file is not getting uploaded.
Please help!!!
# 2  
Old 08-09-2012
You might need test.file on the end of the upload destination there.

Does it print any error messages?
# 3  
Old 08-09-2012
Quote:
Originally Posted by Corona688
You might need test.file on the end of the upload destination there.

Does it print any error messages?
if I try the command outside of the script as below, it is working fine:

Code:
s3cmd put /home/eng/test.file s3://mybucket/

# 4  
Old 08-09-2012
Show your entire script. Maybe your variables aren't being set correctly.
# 5  
Old 08-09-2012
Quote:
Originally Posted by Corona688
Show your entire script. Maybe your variables aren't being set correctly.
Here you go!!

Code:
        echo "Selected the option to Upload file"
        echo " "
        echo "Provide the complete path of the filename to upload to s3"
        read upload_path
        echo " "
        echo "List of Buckets:"
        s3cmd ls
        echo " "
        echo "Provide the destination bucket details to upload: "
        read upload_dest
        echo " "
        echo "source path : ${upload_path}"
        echo "dest path: ${upload_dest}"
        s3cmd put ${upload_path} s3://${upload_dest}

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to pass variables into anothother variables?

Below are three variables, which I want to pass into variable RESULT1 username1=userid poihostname1=dellsys.com port1=8080 How can I pass these variables into below code... RESULT1=$((ssh -n username1@poihostname1 time /usr/sfw/bin/wget --user=sam --password=123 -O /dev/null -q... (4 Replies)
Discussion started by: manohar2013
4 Replies

2. Shell Programming and Scripting

How to write config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

3. UNIX for Dummies Questions & Answers

How to write Config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

4. UNIX for Dummies Questions & Answers

Pass variables from a text file to a shell script

Hi, I have a text file as follows: a.txt ------ STEPS=3 STEP_DURATION=100 INTERVAL=60 I want to use these values in a shell script. How to go about this? (3 Replies)
Discussion started by: akarnya
3 Replies

5. Shell Programming and Scripting

Pass variables to a Unix script from a file

Hi, I am running a Java program from a unix script. I need to pass a variable to the Java code from a file. Here are teh details: cat Parm <<this is my Parameter file>> queuename=queue1 and my shell script is : #!/bin/ksh . ./Parm /opt/java1.5/bin/java -classpath ./java.jar... (1 Reply)
Discussion started by: sangharsh
1 Replies

6. Shell Programming and Scripting

pass perl variables to shell script

I have a perl script that opens a text file containing numbers on each line: for example: 755993 755994 755995 755996 755997 755998 The perl script takes these numbers and store them as an array @raw_data, where I can access individual numbers by using $raw_data for the value 755993.... (2 Replies)
Discussion started by: xchen89x
2 Replies

7. Shell Programming and Scripting

pass variables from one script to another

HI all I am calling a script "b" from script "a". In script "a", i connect to database and get month and year. I have to pass these same values to script b. How can i do that. How can i pass parameters from one script to another (3 Replies)
Discussion started by: vasuarjula
3 Replies

8. Shell Programming and Scripting

how to pass variables from Asterisk to a C-script

Hi!I'm trying to write a script in C that Asterisk must call: I would to pass to the script a number digited by the user, make some elaboration with it and then pass the result to Asterisk. I don't understand the mechanism used by Asterisk to pass variable to/from a script: I know that variables... (1 Reply)
Discussion started by: lucio82
1 Replies

9. Shell Programming and Scripting

reading from a file and pass as variables and ignore # in the file

file.txt contains ------------------ sat1 1300 #sat2 2400 sat3 sat4 500 sat5 I need to write a shell script that will output like the below #output sat1.ksh 1300 sat3.ksh sat4.ksh 500 sat5.ksh my try ------- (4 Replies)
Discussion started by: konark
4 Replies

10. Shell Programming and Scripting

Pass multiple variables to SQL script

I am trying to close of multiple users in an Oracle database. Each users has records in multiple tables what I need to do is use a script that call each SQL seperately passing either CLI arguments or gathered arguments from the users during run time. ## Accept variable(s) from the command line... (1 Reply)
Discussion started by: jagannatha
1 Replies
Login or Register to Ask a Question