I need to to this operation automaticaly:
$ ls
this_folder
$ cp -rf this_folder/* .For this I need to store in a variable the value of the "ls" so that I do something like this:
$ ls
this_folder
$ cp -rf $value_of_the_ls/* .It is possible to do this? Give me some clues.
Best Regards,
21 Answer
To set the output of a command into a variable, use command substitution like this:
$ value_of_the_ls=$(ls)
$ echo "${value_of_the_ls}"Have you thought about what you will do if there are multiple files in the current directory in which case ls will return multiple files?