Timeline for Different behavior in shell script vs in shell?
Current License: CC BY-SA 3.0
14 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 3, 2016 at 16:28 | comment | added | Stéphane Chazelas |
@Utku, it exits the script with an error if $1 is not set. You can also specify the error message like ${1?need a pattern}. In the bash manual, pay attention to the Omitting the colon results in a test only for a parameter that is unset sentence.
|
|
| Oct 3, 2016 at 16:19 | comment | added | Utku |
By the way, what does ${1?} mean? I have read the parameter expansion part of the bash manual but couldn't understand.
|
|
| Oct 3, 2016 at 13:42 | history | edited | Stéphane Chazelas | CC BY-SA 3.0 |
deleted 3 characters in body
|
| Oct 3, 2016 at 13:36 | history | edited | Stéphane Chazelas | CC BY-SA 3.0 |
deleted 3 characters in body
|
| Oct 3, 2016 at 13:35 | comment | added | Stéphane Chazelas | @Utku, yes, that's the point. See my edited answer where I hope it's clearer. | |
| Oct 3, 2016 at 13:19 | history | edited | Stéphane Chazelas | CC BY-SA 3.0 |
added 230 characters in body
|
| Oct 3, 2016 at 13:13 | history | edited | Stéphane Chazelas | CC BY-SA 3.0 |
added 230 characters in body
|
| Oct 3, 2016 at 13:09 | vote | accept | Utku | ||
| Oct 3, 2016 at 13:07 | comment | added | Utku |
Oh, yes of course. But my CMD column includes both process name and command arguments. That is, it includes the full command line that is used to start the process.
|
|
| Oct 3, 2016 at 13:06 | history | edited | Stéphane Chazelas | CC BY-SA 3.0 |
added 230 characters in body
|
| Oct 3, 2016 at 13:04 | comment | added | Stéphane Chazelas |
@Utku, grep -v grep would be to filter out the grep foo line (that grep foo being started by mykill foo) that would match foo. But if the CMD field only contains the process name (so only grep, not grep foo), then that wouldn't make sense. Does the CMD column contain the process name or the command arguments on your system?
|
|
| Oct 3, 2016 at 12:49 | comment | added | Utku |
Regarding the output of ps -A, actually I am getting the former version (PID TTY TIME CMD). I couldn't understand why using grep -v grep would suggest the other output format.
|
|
| Oct 3, 2016 at 12:49 | history | edited | Stéphane Chazelas | CC BY-SA 3.0 |
added 442 characters in body
|
| Oct 3, 2016 at 12:42 | history | answered | Stéphane Chazelas | CC BY-SA 3.0 |