The fact of the matter is that I do not care if the program has been run before and how many times.
TBH, I was more looking to seek an answer in terms of running a simple shell script that will help me run the same program but output results to various path locations.
So basically run program.c in my home directory but output results to path aa/bbb/c
Next, run program.c again and output results to path aa/ddddd/ee
Following code will print the output in different log files each time you run the script.
Log files will have the name prog1.log, prog2.log etc
--ahamed
---------- Post updated at 03:11 PM ---------- Previous update was at 03:06 PM ----------
Follogin will create different log directories with the naming convention of logdir1, logdir2 etc and put the log prog.log.
--ahamed
Last edited by ahamed101; 10-08-2011 at 07:25 PM..
Thanks but the output directories will be in another path, not in the home directory.
You know what guys, think what I want is a bit too complicated or iam being a bit ignorant and it is not actually possible.
Last option - plz help: I want to be able to use a shell script instead of a symlink - is this possible. LEt me take you through an e.g. :
If I wanted to run a program "myprogram.c" in path /aa/bb/cc, I could do as follows:
BUT, I have constantly been hearing that creating too many symlinks is not a good idea, so instead of doing this using the symlink, I want to be able to do the above procedure using a shell script.
I have already tried the following shell script:
To run:
There are a few options to use for running:
% ./myscript.sh ----> but this chanhes the directory back to home directory after run
Apparently the following preserves the changed directory:
% . ./myscript.sh ---> this seems to work for some but does not work for me. It gives me an error mesg "logout: Too many argument"
Longwinded I know but was required. Thanks for any help at all.
You know what guys, think what I want is a bit too complicated...
It's probably not complicated, but, to be frank, you have not done a good job of clearly explaining what you're trying to accomplish.
Even now, we don't know where these different directories that you mention come from. Are they a precompiled list? If so, are they in a file? If not, are they passed to the script as command line parameters? If not, will they be hardcoded into the script? If not a precompiled list, will the code need to walk a hierarchy at runtime to determine what directories currently exist?
You mention 'output results to various path locations'. What does that mean? Are you referring to a stream of data being redirected to a file? Are you referring to using a directory as a location for newly-created files? Are you referring to something else entirely?
What you are trying to do is probably not at all complicated, but the devil is in the details and you've given precious few.
---------- Post updated at 08:42 PM ---------- Previous update was at 08:23 PM ----------
Quote:
Originally Posted by Jatsui
If I wanted to run a program "myprogram.c" in path /aa/bb/cc, I could do as follows:
Why not the more direct /aa/bb/cc/myprogram?
Quote:
Originally Posted by Jatsui
Apparently the following preserves the changed directory:
% . ./myscript.sh ---> this seems to work for some but does not work for me. It gives me an error mesg "logout: Too many argument"
Yes. When you source a script (the dot command), the script's commands are run by the current shell, so any changes to the execution environment persist. As for the source of the error message, we'd need to see the code.
Hello Team .
I am working a health check script ( bash) to run on linux server ( RedHat) and requirements are
1. The o/p of script need to be send to two diff files . I am testing with tee command . But I am not successful yet , any recommendations if that is the right approach ?
2. The same... (2 Replies)
I have been running a program mseed2sac using the following command
cd IV
find . -type f -exec /swadmin/mseed2sac '{}' \;
The problem is that I end up with a lot of files in directory IV.
Instead I would like to select the designator HHZ, create a
directory IV.SAC and all the files output... (11 Replies)
Hi All,
I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise.
Eg :
Select 'Query 1 output' from dual;
Select 'Query 2 output' from dual;
I want to... (3 Replies)
Hi,
I want to grep multiple patterns from multiple files and save to multiple outputs. As of now its outputting all to the same file when I use this command.
Input : 108 files to check for 390 patterns to check for. output I need to 108 files with the searched patterns.
Xargs -I {} grep... (3 Replies)
Hi
I have the following C code
# cat test.c
#include <stdio.h>
main()
{
printf ("The output is : Power\n");
printf ("The output is : No Power\n");
}
The output of this C code is
# ./test
The output is : Power
The output is : No Power
Now i need to pass this outputs into a shell... (4 Replies)
Hi all,
I have a big file (n.txt) with following pattern:
ATOM 1 N SER A 1 122.392 152.261 138.190 1.00 0.00 N
ATOM 2 CA SER A 1 122.726 151.241 139.183 1.00 0.00 C
TER
ENDMDL
ATOM 1 N SER A 1 114.207 142.287 135.439 1.00 0.00 ... (3 Replies)
Hello. This shouldn't be an unusual problem, but I cannot find anything about it at google or at other search machine.
So, I've made an application using C++ and QtCreator. I 've made a new mime type for application's project files.
My system (ubuntu 10.10), when I right click a file and I... (3 Replies)
Hey guys I have written a bash script that compares two directories and displays the files that are different in the directories. Now my problem is the script only runs in my home directory. What do I have to do so it will run in other directories.
Thanks if anyone can help.
Duplicate post.... (0 Replies)
Can someone please help?I have a file - fixed.txt----------------------------AABBBBCCCCCCDDDEEFFFFGGGGGGHHHIIJJJJKKKKKKLLL----------------------------To insert delimiters at fixed lengths of 2, 4, 6, 3, I created a file text1.txt as-------------------2463----------------------and trying to execute... (10 Replies)
Hi.Iam new to Linux.i got linux 7.0 pro and dont know how to run programs. I want a perl interputer and i know i installed one but how do i run it ??? Also how do i run a C or C++ editor ?and how do i run cron ? (3 Replies)