logo
Tags down

shadow

Make variable that is only passed from the command line


By : Thomas Miller
Date : September 16 2020, 02:00 PM
it fixes the issue I know that I can pass variables to a Makefile in two ways: , These methods to pass variables to GNU make aren't equivalent.
code :


Share : facebook icon twitter icon

UNIX: How do I make my script return the sum of the numbers passed to it from the command line?


By : anila
Date : March 29 2020, 07:55 AM
I hope this helps . Here is my current code: , What about this?
code :
while (( $# > 1 )); do
    printf "$1 + "
    sum=$((sum + $1 ))
    shift
done
echo "$1 = $((sum + $1))"
$ sh script.sh 1 2 3
1 + 2 + 3 = 6
$ sh script.sh 1 2 3 4 5
1 + 2 + 3 + 4 + 5 = 15

How to make a shell script take an argument passed in the command line?


By : Dinuka Dilanjana
Date : March 29 2020, 07:55 AM
hope this fix your issue You should indeed use $1, but when you try to run your script just use ./your_script.sh your_argument don't add the % in the beginning.

node-gyp variable behaves differently when passed through command line


By : ClarkeeGee
Date : March 29 2020, 07:55 AM
will help you OK, found it out myself by looking at the generated .sln in Visual Studio. When I pass in the variable via the command line, the backslashes are missing in the generated solution:
code :
/LIBPATH:"C:differentboostdirlib"
'variables': {
  "BOOST_DIR": "<@(BASE_DIR)/../../opt/boost_1_63_0/stage"
},
"VCLinkerTool": {
    ...
    "AdditionalLibraryDirectories": [
        "<@(BOOST_DIR)/lib",
        ...
    ]
}
/LIBPATH:"C:\different\boost\dir\lib"

Breaking variable passed through command line in ansible


By : Josh Dougan
Date : March 29 2020, 07:55 AM
wish helps you I have a line in my playbook which is as follows , There are two ways to do that:
code :
ftp://user:password@mysite/pub/ec/component/{{ version[:-4] }}/{{ version }}/product-{{ version }}-Linux2.6_64-release.tar
ftp://user:password@mysite/pub/ec/component/{{ version.split('.')[0] }}.{{ version.split('.')[1] }}/{{ version }}/product-{{ version }}-Linux2.6_64-release.tar

stat work at the command line but not when passed into a variable


By : DavidH
Date : March 29 2020, 07:55 AM
I hope this helps . I am debugging a bash script (on ubuntu) to obtain an image file block size using stat. The result from stat is correct at the command line but not when passed into a variable (as it is in the script). , No space allowed in a variable declaration; so instead of
code :
b = $(stat --format=%b image.png); echo $b
b=$(stat --format=%b image.png); echo $b
ls  .| egrep '\.png|\.svg|.jpg|.jpeg|.tiff'
for i in *.png *.svg *.jpg *.jpeg *.tiff; do
    # ...
done
shadow
Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk