for me it works in bash on Linux but you can try
cut -d" " -f"$operation"
to avoid parameter expansion. Are not there spaces?
Pregunta
I have a script with the following line in it:
cut -d" " -f$operation
$operation
should be variable, so that it can be for example 1,6
so that cut extracts the first and sixth word of a string, or 2-5
extracting the second until the fifth word. However, this way this does not work out, I guess bash interprets the variable as one string. How can I write this correctly?
Edit
I am very sorry, this question is meaningless. I missed another error, that made the whole thing impossible to work. Thanks to everybody wanting to help.
Solución
for me it works in bash on Linux but you can try
cut -d" " -f"$operation"
to avoid parameter expansion. Are not there spaces?