Forum: Shell Scripting Mar 23rd, 2009 |
| Replies: 11 Views: 1,603 Hey Chris,
It looks like just a simple typo in Aia's reply. Just change $8.2f to %8.2f and you should get "1.20"
, Mike |
Forum: Shell Scripting Mar 18th, 2009 |
| Replies: 4 Views: 1,203 Hey Richard,
For both of those, you can capture the output of your test commands using backticks (will work in any shell) or the $() test in bash
For instance, you could take your statement:
... |
Forum: Shell Scripting Mar 9th, 2009 |
| Replies: 3 Views: 1,045 Hey,
Glad I could help. In the process, you taught me a cool trick. I never knew you could do that... all those years.... exiting over and over again just to get out of a terminal session. It... |
Forum: Shell Scripting Mar 6th, 2009 |
| Replies: 3 Views: 1,045 Hey there,
Sometimes it will work if you just replace your exec call with a simple direct call, so instead of:
just do
<-- Since you're not exec'ing (i.e. replacing the current process... |
Forum: Shell Scripting Mar 5th, 2009 |
| Replies: 2 Views: 800 Hey there,
This should work:
Best wishes,
Mike |
Forum: Shell Scripting Mar 2nd, 2009 |
| Replies: 3 Views: 644 Hey There,
You're probably running into an issue with -p if you're just using a plaintext password. It expects the password to be encrypted using the crypt program (apologies if my assumption is... |
Forum: Shell Scripting Feb 27th, 2009 |
| Replies: 4 Views: 1,440 Hey there,
That can be done. Try this first though, since I find that "human readable" output is usually off. I would grab the information in kb and convert that to Mb. It will probably be more... |
Forum: Shell Scripting Feb 26th, 2009 |
| Replies: 4 Views: 1,440 Hey There,
You coud use the output of format, although if you wanted to automate, you'd have to pipe the right commands to it and then do some processing on the other end, eg, for disk 0:
... |
Forum: Shell Scripting Jan 27th, 2009 |
| Replies: 7 Views: 2,106 Hey There,
Two things, I think:
1. You're not stripping the literal dollar sign from the figures you're trying to add
2. Since you're invoking awk twice, you need to include your BEGIN... |
Forum: Shell Scripting Jan 18th, 2009 |
| Replies: 2 Views: 731 Also, as Salem pointed out, don't forget to use the preceding $ character when you're extracting values from your variables.
Best wishes,
Mike |
Forum: Shell Scripting Jan 9th, 2009 |
| Replies: 16 Views: 5,442 Aia is correct about crontab -e. It does do checking, which is why I put that at the other end of the pipe :)
Basically the reason your script failed is that you need to actually put the control... |
Forum: Shell Scripting Jan 9th, 2009 |
| Replies: 16 Views: 5,442 Hey, Great - I hope it works out :)
Just to answer your questions:
mgolvach@tlaum-pc1 ~ is just my command prompt from my x86 linux box
The DO NOT COPY header is put in there by crontab. ... |
Forum: Shell Scripting Jan 7th, 2009 |
| Replies: 16 Views: 5,442 Hey There,
You should be able to do this with vi (assumming your EDITOR environment variable is set to vi).
First, check out this article on how to "really" insert control characters into your... |
Forum: Shell Scripting Jan 6th, 2009 |
| Replies: 7 Views: 2,146 Hey There,
I think your problem has to do with the "echo" that you're using (shell built-in vs. the binary). I'd guess that on this line, the echo doesn't accept the -e and -n arguments and is... |
Forum: Shell Scripting Jan 5th, 2009 |
| Replies: 7 Views: 2,146 Hey There,
Just a suggestion. If you're using Gnu Sed, you can use the -i option and it will do the changes inline (basically taking care of writing to a tmp file and then copying back, which Aia... |
Forum: Shell Scripting Dec 23rd, 2008 |
| Replies: 3 Views: 1,090 Hey There,
Forgetting about what the "ls" variable evaluates as, it's a pretty simple expression that just looks confusing. It's using expr's ":" string comparison operator.
on the left side... |
Forum: Shell Scripting Dec 17th, 2008 |
| Replies: 6 Views: 2,366 Glad to hear it :)
Best wishes to you,
Mike |
Forum: Shell Scripting Dec 17th, 2008 |
| Replies: 3 Views: 1,221 Hey There,
Unless it's a permissions issue (where you can't delete the folders as the user that runs the batch file) is it possible that you're trying this at the command line as proof-of-concept... |
Forum: Shell Scripting Dec 12th, 2008 |
| Replies: 6 Views: 2,366 Hey There,
You can catch tabs with sed using escape characters. So far tabs, you could match it with:
Hope that helps and best wishes,
Mike |
Forum: Shell Scripting Dec 8th, 2008 |
| Replies: 6 Views: 1,296 Hey there,
One way to pass variables to awk (so you don't have to use double quotes) is with the -v flag, like
and then you could use the variable rBytes1 in your script just like any other... |
Forum: Shell Scripting Dec 5th, 2008 |
| Replies: 10 Views: 2,412 Hey there,
Some excellent suggestions from Fest3er, as well :)
For your version, you may need to include a space. My (non-Gnu) version likes me not to include a space, but I've used Gnu xargs... |
Forum: Shell Scripting Dec 3rd, 2008 |
| Replies: 10 Views: 2,412 Hey there,
You could also just slap it all together on one line and forget about the output file. Try this and let me know if I fat-fingered any of it - this should all be one line if it gets... |
Forum: Shell Scripting Nov 30th, 2008 |
| Replies: 7 Views: 1,078 Actually, either way it's just a normal process. I guess the distinction to be made is that "job control" manages processes and refers to them as jobs. Every job is a process (possibly more than... |
Forum: Shell Scripting Nov 28th, 2008 |
| Replies: 7 Views: 1,078 Hey there,
process/job - terms are sometimes misused or mixed up in regular reference to them, in everything from regular conversation to official text books.
For awk, who, etc, you can run any... |
Forum: Shell Scripting Nov 28th, 2008 |
| Replies: 5 Views: 832 Hey again,
In that case it might just be simpler to do:
sed -e 1,2d -e 6d FILENAME
The reason the command above removes any line starting with a pound is that I write answers in too many... |
Forum: Shell Scripting Nov 27th, 2008 |
| Replies: 5 Views: 832 Hey There,
If you just want to delete files that (I'm assuming) begin with a pound character and start with ifndef,define or endif, you could do it (not very generically in this example) by using... |
Forum: Shell Scripting Nov 26th, 2008 |
| Replies: 3 Views: 815 Hey There,
Your pretty much good, but I just use octals:
so generic file =
644
110 100 100
umask
123 |
Forum: Shell Scripting Oct 29th, 2008 |
| Replies: 10 Views: 2,551 Hey there,
To run them in the foreground, as Salem suggested, just remove the trailing ampersand on all your mdadm commands, so:
mdadm --manage /dev/md0 --add /dev/sdb1 &
becomes
mdadm... |
Forum: Shell Scripting Oct 19th, 2008 |
| Replies: 7 Views: 973 I'm in agreement with Salem, run that file through a quick awk statement to parse it into field based on the tabs and see what you get. It might be the answer you're looking for.
If you have... |
Forum: Shell Scripting Oct 18th, 2008 |
| Replies: 7 Views: 973 Hey There,
If there's any sort of delimiter at all between the fields (for instance, a colon), you can use awk's -F option, like:
and so forth,
Best wishes, |
Forum: Shell Scripting Jul 22nd, 2008 |
| Replies: 4 Views: 1,051 Nice creative fix. Good show!
, Mike |
Forum: Shell Scripting Jul 20th, 2008 |
| Replies: 5 Views: 1,184 Hey There,
Inside the double quotes, in your test statement, the single quotes are being treated as literal characters in the value of the filename variable:
If you just change
to |
Forum: Shell Scripting Jul 17th, 2008 |
| Replies: 3 Views: 1,750 Hey There,
You should be good to go with just a little change-up:
Hope that helps you out :)
, Mike |
Forum: Shell Scripting Jul 17th, 2008 |
| Replies: 4 Views: 1,051 Hey There,
I'm using FreeBSD 4.1 right now and got it to work by just wrapping the regular expression in quotes. It may be that your shell is interpreting the * character before it passes it to... |
Forum: Shell Scripting Jul 17th, 2008 |
| Replies: 4 Views: 1,990 Hey there,
It may just be an issue with calling the variables.
If you change
to |
Forum: Shell Scripting Jul 11th, 2008 |
| Replies: 2 Views: 1,158 Hey there,
You just need to change the
to |
Forum: Shell Scripting Jun 28th, 2008 |
| Replies: 10 Views: 1,875 Hey THere,
Your initial shot was pretty close. Just change:
to |
Forum: Shell Scripting Jun 28th, 2008 |
| Replies: 10 Views: 1,875 Hey There,
You can use expr's colon (:) notation for string comparison, but it might be easier to read and write to do something with grep, like:
echo $1|grep "/" >/dev/null 2>&1
(use -q for... |
Forum: Shell Scripting Jun 17th, 2008 |
| Replies: 9 Views: 3,188 Hey again,
To my knowledge there's no currency routine or built-in in the bash shell, but you could write a function to take care of it.
Also, if this helps, check out this manpage for "units"... |
Forum: Shell Scripting Jun 11th, 2008 |
| Replies: 5 Views: 1,273 No problem,
And thanks for overlooking the fact that I spelled event "even" ;)
I've gotta cut back on the speed-typing ;)
, Mike |