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:
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 Thanks. |
Code:
if (!($ARGV[0] =~ m/^[A-z0-9]*$/)) { |
Code:
$ARGV[0] =~ /^[+-]?\d+$/ And if you put && between your line arguments one will wait to start after successful termination of the previous command. |
Thanks both of you, it's work...
now my second problem... http://www.comptechdoc.org/os/linux/...gcommands.html[/QUOTE] This is not fit because, i want the second command will start after the first command will finish. in this link both of commands are start / not start due errors. |
Hi dome69
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?? |
Hi grail...
Yes, even if the first command were to end with error. but, i want the second command will start after the job of "vi a" will finish. |
In that case the semicolon ';' option will work. (IMHO it would seem not such a great idea to not test
the first command) |
Quote:
I test it before i post. the first command start the command1 and then the command2 but i want command2 will start after command1 will finish his job. |
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. |
Hi...
The script i writing call to my phone. but i want the script start after process is exit. |
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. This is realy doesn't matter. |
1 Attachment(s)
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 :( |
Quote:
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 only have vim and not gvim but no, using
vim a; vimb 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 What happens if you try the same? |
All times are GMT -5. The time now is 03:44 AM. |