Skip to main content
Oops, missing $.
Source Link
Stephen Kitt
  • 484k
  • 60
  • 1.2k
  • 1.4k

In your tests, you used echo to send the value to standard output and thence the pipe, but you left that out in your script. You also need an extra $ to make it a command substitution.

stripped=stripped=$(echo $example | fold -w6 | paste -sd'-' -) 

will give the desired result.

In your tests, you used echo to send the value to standard output and thence the pipe, but you left that out in your script.

stripped=(echo $example | fold -w6 | paste -sd'-' -) 

will give the desired result.

In your tests, you used echo to send the value to standard output and thence the pipe, but you left that out in your script. You also need an extra $ to make it a command substitution.

stripped=$(echo $example | fold -w6 | paste -sd'-' -) 

will give the desired result.

Source Link
Stephen Kitt
  • 484k
  • 60
  • 1.2k
  • 1.4k

In your tests, you used echo to send the value to standard output and thence the pipe, but you left that out in your script.

stripped=(echo $example | fold -w6 | paste -sd'-' -) 

will give the desired result.