Sh vs ./


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sh vs ./
# 8  
Old 07-01-2013
Quote:
Originally Posted by liviusbr
What would be the fastest way to sort this out ?
If it works with bash, then just use bash.

The errors are the result of running a script which depends on arrays and array operations on a shell which does not support arrays. dash aims to be a nimble shell which does not support much beyond the POSIX standard. sh arrays are not part of POSIX.

If you need to port it to sh/dash, then you must abandon the arrays and utilize a different approach, e.g. pipe curl's output into a while-loop.

Also, please, don't be vague when reporting errors. Instead of "still getting an error", post the exact error message.

Regards,
Alister
# 9  
Old 07-02-2013
Try replacing
Code:
IP=($(curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/$MAC_ADDR/local-ipv4s))

with
Code:
IP=$(curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/$MAC_ADDR/local-ipv4s)

Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question