Search Results

Search: Posts Made By: lan123
18,570
Posted By joeyg
What about something like?
$ echo "abc/def/gh/joe.txt" | awk -F"/" '{print $NF}'
joe.txt
6,439
Posted By gary_w
Excellent point, thanks. I corrected my example...
Excellent point, thanks. I corrected my example above for future searchers.
6,439
Posted By Corona688
A much easier way, and a way that can be handled...
A much easier way, and a way that can be handled in any shell not just BASH, is to use -z to check for blank variables.

if [ -z "$VARIABLE" ]
then
...
else
...
fi
6,439
Posted By methyl
The reason it always finds a PID is because it's...
The reason it always finds a PID is because it's finding the grep.

I don't have "bash" hand to try a fix but the "echo" is not needed or desirable (it introduces an extra line terminator which...
6,439
Posted By gary_w
Also eliminate the grep -v grep and save a...
Also eliminate the grep -v grep and save a process by doing this:
LAN_VARIABLE=$(ps -ef | grep "[m]intty" | awk '{print $2}')Matches the string "mintty" but not itself, thus eliminating the need to...
6,439
Posted By alister
[m]intty is both a valid regular expression for...
[m]intty is both a valid regular expression for grep and a valid sh pattern for pathname expansion. If you don't quote that argument, and if the current working directory has a matching item, the...
Showing results 1 to 6 of 6

 
All times are GMT -4. The time now is 04:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy