linux - shebangs script behaving strange in machine to machine -


i have executed below code in 1 linux machine, there executing fine, when execute in linux machine, giving errors like

 error:( declaration not correct -- @ line array=($@)         declare not correct -- @ line declare  hash   code: #! /bin/sh   str="ssidradio0=russia&ssidradio1=japan&country=th&radiob=1&radioa=0&txpowerradio0=8&txpowerradio1=12&radiobchan=3&radioachan=60&publishssidradio0=1&publishssidradio1=1&supportedtxrateradio0=12&supportedtxrateradio1=18&refreshrate=2000&inactperiod=600" ifs='&' set -- $str array=($@) declare  hash in "${array[@]}"; ifs="=" ; set -- $i; hash[$1]=$2; echo ${hash[$1]} >>help;done 

please me

the problem sh softlinked specific shell. can change when context change. in ubuntu, sh bash when start interactive shell , dash if start script. when have switched 10.04 12.04 sh shebanged scripts failed ! might have version problem user2864740 pointed out in comment.

one solution use specific shell in shebang /bin/bash explicitly. make scripts work shell versions/flavors may encounter ^^


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -