Skip to main content
missing " & {…}
Source Link
athena
  • 1.1k
  • 7
  • 24

You will have to change the Internal Field Separator: IFS

q='"Something, variable", another part, third one'

# save actual IFS
_old_ifs="${IFS}"
# set IFS to ","
IFS=","
# split q with this new IFS
set -- `echo $q`${q}`
# restore standard IFS
IFS="${_old_ifs}"

echo \'$1\'

You will have to change the Internal Field Separator: IFS

q='"Something, variable", another part, third one'

# save actual IFS
_old_ifs="${IFS}
# set IFS to ","
IFS=","
# split q with this new IFS
set -- `echo $q`
# restore standard IFS
IFS="${_old_ifs}"

echo \'$1\'

You will have to change the Internal Field Separator: IFS

q='"Something, variable", another part, third one'

# save actual IFS
_old_ifs="${IFS}"
# set IFS to ","
IFS=","
# split q with this new IFS
set -- `echo ${q}`
# restore standard IFS
IFS="${_old_ifs}"

echo \'$1\'
Source Link
athena
  • 1.1k
  • 7
  • 24

You will have to change the Internal Field Separator: IFS

q='"Something, variable", another part, third one'

# save actual IFS
_old_ifs="${IFS}
# set IFS to ","
IFS=","
# split q with this new IFS
set -- `echo $q`
# restore standard IFS
IFS="${_old_ifs}"

echo \'$1\'