I try to save a .csv file in a variable like this:
variable='archivo.csv'
but it gives me an error: file.csv: Command not found
I try to save a .csv file in a variable like this:
variable='archivo.csv'
but it gives me an error: file.csv: Command not found
The use of the "backtick" (that is, the inverted apostrophe: '
) in bash indicates that what is enclosed between backticks is executed and replaced by the result of the execution.
For example:
variable='whoami'
would execute the whoami
command (which returns the user's username ) and leave that name in the variable.
So in your case try to execute archivo.csv
as if it were a command, and you are not capable.
Just use inverted commas. In this case, both 'archivo.csv'
and "archivo.csv"
would serve (the difference is that within double quotes as "
you can use environment variables as $PATH
, which will be expanded to their value, while within the single quotes as '
the $
is not a special character and will not be expanded).