cat ./1.sh
#!/bin/bash
echo $1
set var1 = $1
echo var1 is $var1
kostas@elem:~/1$ argument1 var1 is
How to set var1 from first commandline argument?
The correct assignment is simply the following, with no spaces on either side of the equal sign:
var1=$1
The command set var1 = $1 actually does the following:
$1 to "var1"$2 to "="$3 to the original first parameter $1.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With