Nerdriot
March 5th, 2008, 05:55 AM
Hello,
I'm trying to do a fairly simple task in this script. I'm basically asking the user for what type of settings they'd like to use for a DPG converter. The script that it's executing uses command line args to specify certain settings.
So, I set it up to ask them a series of questions, then take their answers, and write the args to a text file, in order, so at the end of the questions, it will execute the script with those arguments attached.
But here's my problem: I created one file, and when they select the first option, it simply uses "echo" to copy that to the file. The next option, when they select it, all I really want to do is keep the file the way it is, and use "sed" to attach the new option to the end of the first line. However, it doesn't seem like I'm able to do that, without doing this:
cat file | sed '1s\$\ -arg2\' > file2 | cat file2 > file
Surely there's a way to do this, without having to create 2 files. I know one of you smart folks has a way, too. :)
Thanks in advance ;)
I'm trying to do a fairly simple task in this script. I'm basically asking the user for what type of settings they'd like to use for a DPG converter. The script that it's executing uses command line args to specify certain settings.
So, I set it up to ask them a series of questions, then take their answers, and write the args to a text file, in order, so at the end of the questions, it will execute the script with those arguments attached.
But here's my problem: I created one file, and when they select the first option, it simply uses "echo" to copy that to the file. The next option, when they select it, all I really want to do is keep the file the way it is, and use "sed" to attach the new option to the end of the first line. However, it doesn't seem like I'm able to do that, without doing this:
cat file | sed '1s\$\ -arg2\' > file2 | cat file2 > file
Surely there's a way to do this, without having to create 2 files. I know one of you smart folks has a way, too. :)
Thanks in advance ;)