I have a small function like this -
#! /bin/sh
function hey() {
a=$1
echo $a
}
x=2
hey x
As per my understanding it should print 2
but it is printing x
. How to resolve it?
Running you code in my bash (not sh) , it also prints x. But if i change the last line to
hey $x
then it prints 2.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.