Save .csv in variable

0

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

    
asked by Chariot 24.10.2018 в 13:17
source

1 answer

1

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).

    
answered by 24.10.2018 / 16:17
source