Search Results

Search: Posts Made By: era
10,965
Posted By era
"exit" will always exit, the number is the result...
"exit" will always exit, the number is the result code returned by the script from which you exited. An exit code of zero conventionally means "no error", any other number is treated as an error. ...
10,965
Posted By era
test -s file66.txt || { mailx -s "file66.txt size...
test -s file66.txt || { mailx -s "file66.txt size zero" you@example.net </dev/null; exit 99; }
echo "Shell Script Worked"


The braces are used when there are multiple commands you want to...
Forum: Debian 12-18-2008
40,570
Posted By era
The \n") looks wrong but I also think it's...
The \n") looks wrong but I also think it's relatively harmless. It will botch the "ro" argument so the kernel will not see it, but IIUC that's the only harm it does.

In fact, I think the tangent...
11,363
Posted By era
You are correct of course; the matching is...
You are correct of course; the matching is greedy, and tries its darndest to find a match, so using a negation between wildcards will find a match if there is a way to match it, regardless of the...
5,380
Posted By era
The field separator is missing from radoulov's...
The field separator is missing from radoulov's script.

awk -F, 'NR==FNR{_[$1];next}$1 in _' gprs2.txt gprs_calls2.txt

Your description of the output you require is not understandable to me. ...
7,692
Posted By era
This evaluates to the three tokens "cp",...
This evaluates to the three tokens "cp", "junk\junk.txt", "junkjunk.txt" -- note the single backslash in the actual file name. You double the backslash because the shell interprets backslashes...
11,363
Posted By era
Why not use plain old case? case $string in ...
Why not use plain old case?

case $string in
*[!0-9A-Za-z]*) echo "Not pure alpha + numbers" ;;
*[!0-9]*) echo "Pure alpha";;
'') echo "Empty string (duh)" ;;
*) echo "Pure numbers" ;;...
5,159
Posted By era
What if there are multiple /usr/bin/whatever...
What if there are multiple /usr/bin/whatever lines?
12,045
Posted By era
The 033 in the od output you posted is the escape...
The 033 in the od output you posted is the escape character. The sequence ESC [ 0 m returns the terminal to regular black on white (or whatever default you have).
3,605
Posted By era
Yeah, you could cut on [ if you want to remove...
Yeah, you could cut on [ if you want to remove the brackets. The awk is rather unnecessary, though.

cut -d'[' -f2 file | cut -d']' -f1 >newfile
3,252
Posted By era
Neither of those example lines have a display...
Neither of those example lines have a display width of over 79 characters. Anyway, again: a tab is a single character and the script counts characters. If you want to work on the display width, you...
3,605
Posted By era
cut -f2 file >newfile
cut -f2 file >newfile
20,495
Posted By era
That will only pick out the first occurrence,...
That will only pick out the first occurrence, though. The original awk script would return all matching lines. Not hard to work around if you know any Perl, just mentioning in case you're new to...
2,895
Posted By era
I'm guessing cfajohnson meant yes=( $(grep...
I'm guessing cfajohnson meant

yes=( $(grep yes$ myfile) )
no=( $(grep no$ myfile) )

Your awk script only picked out the first field, whereas this will pick out the whole lines. Which do you...
7,664
Posted By era
I'm guessing you might have multiple spaces in...
I'm guessing you might have multiple spaces in your input file, but we can't see those because you didn't use code tags (https://www.unix.com/misc.php?do=bbcode#code) -- please post again with those...
3,252
Posted By era
Like mentioned above, you will need to expand...
Like mentioned above, you will need to expand tabs. A tab character is a single character but uses the width of up to 8 characters. You can calculate the actual width of each tab yourself, but it's...
25,198
Posted By era
You don't need to cd to a directory -- any...
You don't need to cd to a directory -- any file-oriented command will accept a full path name just as well as a plain file name.

mkdir -p /root/.ssh # -p makes it not do anything if the directory...
2,606
Posted By era
Passing in commands over standard input works for...
Passing in commands over standard input works for me here. You can pass in a fairly complex script in single quotes just as well, though -- just take care not to try to use single quotes in the...
2,365
Posted By era
You need to use eval to expand a variable inside...
You need to use eval to expand a variable inside another variable.

eval echo $start_path
3,810
Posted By era
If runProcess is competently written, it will set...
If runProcess is competently written, it will set its exit code to non-zero if it fails.

if ./runProcess.sh whatever; then
: success, do nothing
else
echo "eek, failed with exit code $?"...
25,198
Posted By era
It's not crucial that it's your login shell; you...
It's not crucial that it's your login shell; you can limp along anyway. As a workaround, just exec bash immediately after you log in.
4,186
Posted By era
sed -n -e 's%^start testcase: %Testcase:%p' -e...
sed -n -e 's%^start testcase: %Testcase:%p' -e '/^error /p' file
8,425
Posted By era
You need to chomp the output from backticks; it...
You need to chomp the output from backticks; it contains a trailing newline.

Beyond that, if it still doesn't work, it would be most helpful if you could say how it doesn't work.

(In the die...
3,905
Posted By era
If your find has the -atime switch, try using...
If your find has the -atime switch, try using that.
7,664
Posted By era
Or with sed: sed '/-A INPUT -j REJECT...
Or with sed:

sed '/-A INPUT -j REJECT --reject-with icmp-host-prohibited/i\
-A INPUT -p udp -m udp --dport 27020 -j ACCEPT' file >newfile

There are different dialects of sed so you might need...
Showing results 1 to 25 of 500

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