I have a script called script.sh that has the following in it.
cat /home/auto/script.sh
I need a way to run this script, and then, after script has confirmed the argument given to it, i'd like to comment out the section of the script that confirmed the argument (lines 2-9). in other words, i basically want to add a "#" to the beginning of lines 2 to 9. Then, after those lines are commented out, id like to append the word "date" to the end of the script. then run the script again.
I'm trying to do this all in one go. But i'm not sure how to go about it.
The logic should be something like this:
I'm aware this command is 100% wrong, but the idea of it is what i'm after. i'm hoping someone can re-write it for me. I want to be able to do this with a one-liner. or at least something close to it.
i would prefer not to have to create several little temp scripts which are to be deleted later (unless they can be created in memory, not hard disk). i want all this to be done within the "script.sh" script. but if there are no other solutions, i wouldn't mind it creating temps.
That's a very interesting idea, having shell scripts that more or less edit themselves. I do see a possible practical problem here. If the script comments out the test lines and adds 'date' at the end, what use is the script in the future? Just commenting those lines and adding 'date' doesn't seem useful, but there might be some other variation that is perhaps quite useful.
That's a very interesting idea, having shell scripts that more or less edit themselves. I do see a possible practical problem here. If the script comments out the test lines and adds 'date' at the end, what use is the script in the future? Just commenting those lines and adding 'date' doesn't seem useful, but there might be some other variation that is perhaps quite useful.
there is a use. but explaining the use will take forever. so i just want to get this small (seemingly small), section out of the way first before even attempting to go into deeper details. but if someone can accomplish the situation i laid out above here, everything else is simple.
i'm sure (at least i hope) someone on here knows of a way to do this.
Hi All,
I want to write a domain specific REST/HTTP server to run on FreeBSD. I have control over both the server side and the primary client intended to consume the service.
My question is: how do you think it should be designed to support multiple connections, given:
It will run on a... (6 Replies)
Hi,
Brand new to these forums, and I hope that someone can help me out.
I'm trying to run the following command in UNIX
java -jar GenomeAnalysisTK.jar -T SplitSamFile -dt NONE -R reference.fa -I my.bam --outputRoot /my/path/SampleFiles/Sample_
It executes the SplitSamFile from GATK, but I... (3 Replies)
Hi all,
I currently have a UNIX file maintenance script that runs daily as a cron job.
Now I want to change the script and create functions/sub inside it that runs on a weekly or monthly basis.
To run all the scripts' daily maintenance, I want to schedule it in cron as simply maint.sh... (1 Reply)
Hi everyone,
when executing this command in unix:
echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error.
here is content of my script:
tdbsrvr$ vi hc.sh
"hc.sh" 22 lines, 509... (4 Replies)
I developed a script in Lingon (which is an automated script editor developed for OS X) that is used to automatically restart programs only if they crash. The script itself does just that, but I only want it to load if I'm going to use the specific application that it's designed to protect. In the... (2 Replies)
I developed a script in Lingon (which is an automated script editor developed for OS X) that is used to automatically restart programs only if they crash. The script itself does just that, but I only want it to load if I'm going to use the specific application that it's designed to protect. In... (3 Replies)
Hello,
I am trying to learn how to pass something more than a one-command startup for gnome-terminal.
I will give an example of what I'm trying to do here:
#! /bin/bash
#
#TODO write this for gnome and xterm
USAGE="
______________________________________________
${0##*/}
run... (0 Replies)
Hi
I am very new to Linux programming,otherwise I have exposure to Linux. Was thinking about something like writing my own commands for Linux. Any ideas where to start, any useful links and what I need to know before I start with this.
Thanks :)
Sidhu (3 Replies)
As the subject states, I am re-writing the ls -F command in C++, but I am having trouble adding some of the Formatting characters to the files names. Here is my code:
if (strcmp(buff, "-F")==0)
{
struct stat s;
stat(direntp->d_name,&s);
cout<<direntp->d_name;
... (3 Replies)