Sponsored Content
Top Forums Shell Programming and Scripting Argument Problems with ncftpput Post 302684153 by CharlesKirk on Friday 10th of August 2012 07:49:53 AM
Old 08-10-2012
Quote:
Originally Posted by Corona688
Quotes do not work that way. Instead of wondering why, just test what they actually do:

Code:
$ var="asdf"

$ echo '"$var"'

"$var"

$ echo "'$var'"

'asdf'

$ echo "$var"

asdf

$

Therefore, shell doesn't actually do what you think it does.

Putting variables in double-quotes is a good idea when you don't want them to split. Single quotes don't evaluate variables at all. And extra quotes inside double quotes don't get evaluated, just stick around.
Okay, I understand now.

My code is now:
Code:
#/bin/bash

echo "Running command: ncftpput -R -u "$2" -p "$3" "$1" "$5" "$4""
ncftpput -R -u "$2" -p "$3" "$1" $5 $4

Code:
./ftpWebsite.sh '1.2.3.4' 'username.co.uk' 'pass.!pass' /var/www/vhosts/username.co.uk/httpdocs/ /public_html

This - WORKS! Smilie

Code:
./ftpWebsite.sh '1.2.3.4' 'username.co.uk' 'pass.!pass' /var/www/vhosts/username.co.uk/httpdocs/* /public_html

This however, doesn't, with the * to denote the contents of the folder, not the folder itself, it complains about not being able to change to a directory, and the "directory" it lists, is the first file in that folder... how do I use *?

Thanks in advance.

---------- Post updated 08-10-12 at 06:49 AM ---------- Previous update was 08-09-12 at 07:19 AM ----------

Sorry to bump, but I'm still having troubles with this script...could anybody point me in the right direction?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

'make' problems (compliation problems?)

I'm trying to compile and install both most recent version of 'make' and the most recent version of 'openssh' on my Sparc20. I've run into the following problems... and I don't know what they mean. Can someone please help me resolve these issues? I'm using the 'make' version that was... (5 Replies)
Discussion started by: xyyz
5 Replies

2. Shell Programming and Scripting

argument help

if i have 2 arguments $1 and $2 how can i append them so that $2 is added to $1? It is really confusing me because it seems so simple, yet i can't get the shell script to work properly. Thanks. (2 Replies)
Discussion started by: brentdeback
2 Replies

3. UNIX for Dummies Questions & Answers

How to find the last argument in a argument line?

How to find the last argument in a argument line? (4 Replies)
Discussion started by: nehagupta2008
4 Replies

4. Shell Programming and Scripting

Strict Argument

Im trying to write a bash script that has an if statment that when the user enters ONLY that exact argument, will echo what follows that conditon. For example: for file in $1 do if then Var1=$(cat hello | egrep "that pattern" | awk '{ print $NF }') cat $Var1 fi done Basically,... (3 Replies)
Discussion started by: oxoxo
3 Replies

5. Shell Programming and Scripting

get positive number n as argument script must calculate the factorial of its argument

Can someone please help me with this SHELL script? I need to create a script that gets a positive number n as an argument. The script must calculate the factorial of its argument. In other words, it must calculate n!=1x2x3x...xn. Note that 0!=1. Here is a start but I have no clue how to... (3 Replies)
Discussion started by: I-1
3 Replies

6. Shell Programming and Scripting

Cannot compare argument in if statement in csh/grep command if argument starts with “-“

If ($argv == “-debug”) then Echo “in loop” Endif But this is not working. If I modify this code and remove “-“, then it works. Similarly I am getting problem using grep command also Grep “-debug” Filename Can someone please help me on how to resolve these... (1 Reply)
Discussion started by: sarbjit
1 Replies

7. Shell Programming and Scripting

argument

Im sorry but I'm in need of help. How would I give the user the option to include the name of an html file as an arugment for the script? but if none is provided, then the script should prompt the user for the file name. I have sed 's/<*>//g' yourfile.html | uniq >newfile.txt so far I have... (7 Replies)
Discussion started by: clicstic
7 Replies

8. UNIX for Dummies Questions & Answers

Argument in Linux

I am trying to see the commands that can work also with only one argument. I tried that man to see the commands details but could not figure out. Here in my scenario I have ln, cp and mv commands. I am trying to see if these command can also work with just one argument. It looks like cp works if I... (3 Replies)
Discussion started by: linux17
3 Replies

9. Shell Programming and Scripting

Make script that run with argument if not run from configuration file argument

Hello, Is there any method thorugh which script can take argument if pass otherwise if argument doesn't pass then it takes the argument from the configuration file i.e I am workiing on a script which will run through crontab and the script will chekout the code ,zip and copy to the... (3 Replies)
Discussion started by: rohit22hamirpur
3 Replies

10. UNIX for Advanced & Expert Users

Error:--test: argument expected--Even though i give an argument.

Hi All, I am running the script VBoxManage list vms |sed 's/"//g' | cut -d " " -f1 > har1out.mytxt result=`cat har1out.mytxt | grep $1' echo $result echo $1 { if then echo pass else echo fail fi (2 Replies)
Discussion started by: harsha85
2 Replies
ATF-SH(1)						    BSD General Commands Manual 						 ATF-SH(1)

NAME
atf-sh [-s shell] -- interpreter for shell-based test programs SYNOPSIS
atf-sh script DESCRIPTION
atf-sh is an interpreter that runs the test program given in script after loading the atf-sh(3) library. atf-sh is not a real interpreter though: it is just a wrapper around the system-wide shell defined by ATF_SHELL. atf-sh executes the inter- preter, loads the atf-sh(3) library and then runs the script. You must consider atf-sh to be a POSIX shell by default and thus should not use any non-standard extensions. The following options are available: -s shell Specifies the shell to use instead of the value provided by ATF_SHELL. ENVIRONMENT
ATF_LIBEXECDIR Overrides the builtin directory where atf-sh is located. Should not be overridden other than for testing purposes. ATF_PKGDATADIR Overrides the builtin directory where libatf-sh.subr is located. Should not be overridden other than for testing purposes. ATF_SHELL Path to the system shell to be used in the generated scripts. Scripts must not rely on this variable being set to select a specific interpreter. EXAMPLES
Scripts using atf-sh(3) should start with: #! /usr/bin/env atf-sh Alternatively, if you want to explicitly choose a shell interpreter, you cannot rely on env(1) to find atf-sh. Instead, you have to hardcode the path to atf-sh in the script and then use the -s option afterwards as a single parameter: #! /path/to/bin/atf-sh -s/bin/bash ENVIRONMENT
ATF_SHELL Path to the system shell to be used in the generated scripts. SEE ALSO
atf-sh(3) BSD
September 27, 2014 BSD
All times are GMT -4. The time now is 04:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy