[SOLVED] ARGV[0] number or letters? & ranning script after finish previous program.
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
ARGV[0] number or letters? & ranning script after finish previous program.
Hi...
how can I recognize at perl if ARGV[0] is number or letters?
Quote:
#!/usr/local/bin/perl -w
use strict;
if (!defined($ARGV[0])) {
print "no value entered\n";
exit;
}
And another issue...
There is any way to ran script after previous program is finished?
Exmp: vi a ; script.file
"script.file" will ran only after "vi a" will finish his job
I think you will need to explain more about what you require?
Are you saying that even if the first command (ie vi a) were to end with an
error that you would still want script.file (assuming this is an executable) to run??
Then you might want to give us more information about what commands you are running as this is not the normal
behaviour, unless the first command spawns into the background to continue.
Which process?
It seems odd as if it does not matter if the previous process finishes successfully or not
then it would appear they are unrelated and running one prior to the other is not important.
This is not matter because i have process that ranning 1 - 8 hours maybe more and i want to know when it will finish.
after that i will debug if there was errors or not.
Ok, I will take your word for it, but, this still does not help us if we do not know how your first command is running??
Let me try and use an example similar to your previous one:
example - vim dates.txt ; touch new_file
Expected results: vim will open dates.txt and the new_file will not be created until I close / exit vim (see attachment pdf for screenshots in order)
1. First screenshot is of terminal open with two tabs set to the same directory location and the above example set to run
2. After pressing enter, second screenshot shows terminal with vim viewing dates.txt
3. Third shows after moving to other tab in terminal and running ls in directory to show that new_file has not yet been created
4. Fourth shows back in original tab and having exited vim and running the ls command, now showing that new_file has been created only after previous program has ended
If your first command is headless or runs in the background we need to know otherwise I cannot see a away to assist you
Ok, I will take your word for it, but, this still does not help us if we do not know how your first command is running??
Let me try and use an example similar to your previous one:
example - vim dates.txt ; touch new_file
Expected results: vim will open dates.txt and the new_file will not be created until I close / exit vim (see attachment pdf for screenshots in order)
1. First screenshot is of terminal open with two tabs set to the same directory location and the above example set to run
2. After pressing enter, second screenshot shows terminal with vim viewing dates.txt
3. Third shows after moving to other tab in terminal and running ls in directory to show that new_file has not yet been created
4. Fourth shows back in original tab and having exited vim and running the ls command, now showing that new_file has been created only after previous program has ended
If your first command is headless or runs in the background we need to know otherwise I cannot see a away to assist you
I realy don'y understand while i'm running the first command the second start without waiting for the finish of the first.
how its can be that you ranning 2 commsnds separate by ";" and the second wait until the first one will finish.
lets test it...
gvim a ; gvim b
do you get both windows?
if you get both windows opens thats mean that the "gvim b" don't wait for the first command will finish.
what i want is after closing job "gvim a" the "gvim b" will start.
I get the a file opens and I can edit and so on and then as soon as I close it I am placed straight into
b file to edit.
Also, I did a ps ax | grep vim after hitting enter and then again after closing the first file.
Output is:
Code:
grail@wetworks:~/Documents/programming/bash$ ps ax | grep vim
13638 pts/0 S+ 0:00 vim a
13658 pts/1 R+ 0:00 grep --color=auto vim
grail@wetworks:~/Documents/programming/bash$ ps ax | grep vim
13659 pts/0 S+ 0:00 vim b
13661 pts/1 S+ 0:00 grep --color=auto vim
As you can see, clearly only one copy of vim running at a time.
What happens if you try the same?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.