Related
silver glitter I'm making a script for synchronizing directories with rsync over ssh. I'm having trouble trying to define a custom port. Suppose a normal working script has the following syntax: #! /bin/sh
rval=2222
port="ssh -p $rval"
rsync --progress -av -
silver glitter I'm making a script for synchronizing directories with rsync over ssh. I'm having trouble trying to define a custom port. Suppose a normal working script has the following syntax: #! /bin/sh
rval=2222
port="ssh -p $rval"
rsync --progress -av -
silver glitter I'm making a script for synchronizing directories with rsync over ssh. I'm having trouble trying to define a custom port. Suppose a normal working script has the following syntax: #! /bin/sh
rval=2222
port="ssh -p $rval"
rsync --progress -av -
silver glitter I'm making a script for synchronizing directories with rsync over ssh. I'm having trouble trying to define a custom port. Suppose a normal working script has the following syntax: #! /bin/sh
rval=2222
port="ssh -p $rval"
rsync --progress -av -
Markus Mayr I have a program that I want to call by passing arguments from shell variables. Throughout the question, I will assume that it is determined by #!/bin/sh
echo $#
That is, it prints out the number of arguments passed to it. call it count-args. I ca
Adi Gerber See edit below, thanks I have the following test script ( IMPORTANT: I cannot change this part ): while (($#)); do
echo $1
shift
done
Running the command ./test aaa "bbbb cccc" dddwill give the following output: aaa
bbbb cccc
ddd
This is what
Adi Gerber See edit below, thanks I have the following test script ( IMPORTANT: I cannot change this part ): while (($#)); do
echo $1
shift
done
Running the command ./test aaa "bbbb cccc" dddwill give the following output: aaa
bbbb cccc
ddd
This is what
Donnoughue I have a file called fruit.txt which contains a list of fruit names (apple, banana.orange, kiwi, etc). I want to create a script that allows me to pass arguments when calling the script, i.e. script.sh orange, which will then use grep to search for
Chaike On the bash shell, I want to pass arguments via environment variables. like this... $ export DOCKER_OPTIONS="-p 9200:9200 -e ES_JAVA_OPTS='-Xmx1g -Xms1g' -d "
$ docker run -d $DOCKER_OPTIONS elasticsearch
I want to pass "ES_JAVA_OPTS='-Xmx1g -Xms1g'" a
Chaike On the bash shell, I want to pass arguments via environment variables. like this... $ export DOCKER_OPTIONS="-p 9200:9200 -e ES_JAVA_OPTS='-Xmx1g -Xms1g' -d "
$ docker run -d $DOCKER_OPTIONS elasticsearch
I want to pass "ES_JAVA_OPTS='-Xmx1g -Xms1g'" a
Frederick I want to put the bash command to be executed in a variable and then execute that variable. The command has parameters, some of which may contain spaces. How can I do this? What I've tried so far is this: nbargs(){ echo $#; } # define some f
Chaike On the bash shell, I want to pass arguments via environment variables. like this... $ export DOCKER_OPTIONS="-p 9200:9200 -e ES_JAVA_OPTS='-Xmx1g -Xms1g' -d "
$ docker run -d $DOCKER_OPTIONS elasticsearch
I want to pass "ES_JAVA_OPTS='-Xmx1g -Xms1g'" a
Chaike On the bash shell, I want to pass arguments via environment variables. like this... $ export DOCKER_OPTIONS="-p 9200:9200 -e ES_JAVA_OPTS='-Xmx1g -Xms1g' -d "
$ docker run -d $DOCKER_OPTIONS elasticsearch
I want to pass "ES_JAVA_OPTS='-Xmx1g -Xms1g'" a
Frederick I want to put the bash command to be executed in a variable and then execute that variable. The command has parameters, some of which may contain spaces. How can I do this? What I've tried so far is this: nbargs(){ echo $#; } # define some f
Bacchus There is a shell script which in turn runs a Java program. The script is called as follows: ./script.sh 1 2 3 4 "ab cd"
The 5th shell parameter (ab cd) has to be passed as a java system property, what I'm doing is: JAVA_OPTS="-Xmx512M -Dlog4j.defaultI
User 2932003 I want to pass the $SPACE variable into the Expect script and get the output and then again into the Shell script. #!/bin/bash -x
SPACE=$(df -h | awk '{ print $5 }' | grep -v Use |sort -n |tail -1 | cut -d % -f1)
#set user "root"
#set
no data
loss frequency Is it possible to pass arguments from shell script and pass it to file. This is what I basically want to achieve: my script: #!/bin/bash -
input=$1
DIR=/home/user/
File=$DIR/test.txt
`cat $File` < $input
Here is test.txt: select * from abc
loss frequency Is it possible to pass arguments from shell script and pass it to file. This is what I basically want to achieve: my script: #!/bin/bash -
input=$1
DIR=/home/user/
File=$DIR/test.txt
`cat $File` < $input
Here is test.txt: select * from abc
Paul I know that shell scripts just run commands as if they were executed at the command prompt. I'd like to be able to run a shell script like a script...that is, bring an input value or string into the script. How can I do this? Bruce Ediger The shell comman
no data
Paul I know that shell scripts just run commands as if they were executed at the command prompt. I'd like to be able to run a shell script like a script...that is, bring an input value or string into the script. How can I do this? Bruce Ediger The shell comman
A generation A very simple problem might be but can't get it to work. ...basically, I have an XML file, and internally, for unavoidable reasons, I choose a shell script that allows me to pass a small number of arguments to an external program. Now it works mos
Keerthisairam I want to execute a shell script used in a usage()script. I have to provide three parameters in the usage block like this: ./script_name server_name path flag
How can I write code blocks? Finally, I need to read all three parameters in one line
Alik Elzin-kilaka I have a script that processes data, creates parameters and sends it to a second script. One of the parameters contains a space. script1.sh: args=()
args+=("A")
args+=("1 2")
args+=("B")
. script2.sh ${args[@]}
script2.sh: for f in "$@"
do
Alik Elzin-kilaka I have a script that processes data, creates parameters and sends it to a second script. One of the parameters contains a space. script1.sh: args=()
args+=("A")
args+=("1 2")
args+=("B")
. script2.sh ${args[@]}
script2.sh: for f in "$@"
do
Alik Elzin-kilaka I have a script that processes data, creates parameters and sends it to a second script. One of the parameters contains a space. script1.sh: args=()
args+=("A")
args+=("1 2")
args+=("B")
. script2.sh ${args[@]}
script2.sh: for f in "$@"
do
Christopher 2007 I have the following script (example): #!/bin/bash
while getopts a: opt; do
case "$opt" in
a) val="$OPTARG";;
?) echo "use the flag \"-a\""
exit 2;;
esac
done
echo "a specified with: ${val}"
When I call th
smiling diver What I want to achieve is to read command line arguments from a file and use them to invoke a command. So essentially I need to pass arguments through bash variables. The problem is that there are spaces in some parameters. How can I do this? Cod