I have a linux script that generates a string and prints it to the console. I want this string to be the name of a file and open it for editing in vi. How can this be done?
Use the backtick char to escape the script: (on the same key as the tilde ~ char)
And if the output has spaces that you stil want to see as a single parameter:
Does your script do this?
will create a file named
The -n tells echo not to emit a newline. The exec command doesn't execute anything, just changes the stdout (#1) and stderr (#2). The 2>&1 says to make 2 (stderr) go to the same place as 1 (stdout).