0

Possible Duplicate:
Split string based on delimiter in bash?

i have a shell script which call by php and pass a variable ($1)

When i using MYVAR = $1, and echo MYVAR is not working

how can i assign this variable ($1) to another variable and split it with delimiter "," and convert it into a array for looping?

Community
  • 1
  • 1
user192344
  • 1,274
  • 6
  • 22
  • 36

1 Answers1

4

Well, guessed answer in absence of code.

Variable assignments in shell scripts must be:

  MYVAR=$1

Spaces around are incorrect:

  MYVAR = $1

And the echo must output an actual variable, using the $ prefix:

  echo $MYVAR

Not just the literal string:

  echo NOVAR
mario
  • 144,265
  • 20
  • 237
  • 291