How to get the current running Java processes with full argument
Answer:
To do so, use the command:
#jps -mlvV
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to get the current running Java processes with full argument
Answer:
To do so, use the command:
#jps -mlvV
Trap bash exit signal
Answer:
To trap your script before exit, you can use the trap in bash, e.g.
#!/bin/bash
set -eu
function bye {
echo "Good bye"
}
trap bye EXIT
sleep 1000
# Quit the script by pressing Ctrl+C
Writing more robust shell script
Answer:
You should always start your bash shell script with the line set -eu
The meaning is:
Use Perl to split string instead of awk
Answer:
If you know Perl well, there is no need to use awk to do string processing such as string splitting, it is easy with Perl also, e.g.
# echo "foo,bar,k3" | perl -F',' -lane 'print $F[1]'
bar
How to assign a raw string in Python
Answer:
In Python, if you want to assign a raw string without any character escape, you can use the following:
s = r'\\foo\\\bar'
print s