- Strength to Increase Rep
- +8
- Strength to Decrease Rep
- -2
- Upvotes Received
- 9
- Posts with Upvotes
- 9
- Upvoting Members
- 6
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Unix/Linux Administrator
- Interests
- writing, computers, guitar
236 Posted Topics
Re: Hey There, You may just need to remove one argument from your uuencode line so [QUOTE]/usr/bin/uuencode $file.Z $file.Z | /usr/bin/mailx -s "Report for COB $YESTERDAY" "joe.blogs@hotmail.com"[/QUOTE] becomes [QUOTE]/usr/bin/uuencode $file.Z | /usr/bin/mailx -s "Report for COB $YESTERDAY" "joe.blogs@hotmail.com"[/QUOTE] you can also user tar and gzip (if you have the Gnu version … | |
Re: If you're interested in building an OS, you should also get into c and c++ programming. If you look around hard enough you can find lots of good tutorials. A lot of times, even O'Reilly books show up online on overseas .edu sites. Good luck :) , Mike | |
Re: Hey There, You can also try [ICODE]HELO whateveryourdomainis.com[/ICODE] and see if the mailserver isn't just dishing you for not identifying your origin. or try [ICODE]EHLO ..etc, etc, etc[/ICODE] and, like omrsafetyo mentioned, you'll probably need to authenticate. Best wishes, Mike Maybe, maybe not.[QUOTE=subhashmedhi;648762]But if i use the following code [code] … | |
Re: a's got 100 b's got 9 you need the 91 uniques - I'll put 'em in c.txt [CODE]while read line do grep $line b.txt >/dev/null 2>&1 if [ $? -ne 0 ] then echo $line >>c.txt fi done <a.txt[/CODE] Sorry - just needed to drop a post somewhere - it's … | |
Re: Hey There, What you're trying to do is possible, if you use a program like "expect" to pass your password interactively (well, mock-interactively ;) to ssh and/or scp. However, your downside security wise would be much steeper than setting up dsa keys and strict trust (user@ip, etc). Are you avoiding … | |
Re: You can also "cut" out the first field before you sort, if you want :) , Mike | |
Re: 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 scripts (like ^H backspace rather than a ^ symbol followed by a capital H): [url]http://linuxshellaccount.blogspot.com/2007/10/how-to-really-represent-control.html[/url] Then, … | |
Re: Hey there, If you're interested, just for kicks, here's the long convoluted way to do it :) [url]http://linuxshellaccount.blogspot.com/2008/01/unix-and-linux-shell-script-to-remind.html[/url] Cheers, Mike | |
Re: Hi there, It's probably expecting a reply to the password: prompt from su. You can make it all one line and get away with it, but you'd still have to enter 3 passwords (assuming you're not su-ing postgres as root) - one for the su - one for the createuser … | |
Re: Hey There, Your getting the result from the backticks is valid. I can't be sure about the mysql() function that you're referencing though. Can you post that? Thanks, , Mike | |
Re: You're pretty much there. I usually use sendmail, so pardon the substition. I think it's either output redirection or the mail command, but this should work (assuming your command works when run at the command line!) [CODE]37 01 24 1 * (echo "Subject: file compare output";/usr/local/bin/perl /tpf106/data2/cis_web/cis3/cis3.11/work/rishi/s-branch/perl1/perl/compare.pl 2>&1)|/usr/lib/sendmail rishi83@yahoo.in[/CODE] | |
Re: Hey There, This link probably answers all of your questions. Just pick the compiler you'll be using to build the package and they should have it listed (if not, use yum or apt-get to grab it and all it's dependencies) [url]http://opencvlibrary.sourceforge.net/CompileOpenCVUsingLinux[/url] Happy building :) , Mike | |
Re: Hey There, I think the easiest thing, and which might cut out some other problems for you, is to source the environment (user or global) into the script. For instance: #!/bin/ksh . /etc/profile # Read in the system profile . /home/user/.profile # read in the users profile That way you're … | |
Re: Hey there, If you're doing this for C, you can just use quotes instead of the angle brackets, like [CODE]#include "/home/yourdir/myInclude/header.sh"[/CODE] If you're using a shell and your includes are functions, you can put them in your .profile, as advised above or just create your header.sh file and source it … | |
Re: Hey There, You can try piping everything to sendmail -t (mail and mailx use sendmail). The -t flag means you have to specify headers, though, so: [CODE](echo "Subject: My Subject";echo "From: my@address.com";echo "To: your@address.com";echo "Reply-To: my@address.com";echo "X-Whatever: Any Other Headers You Want To Include";echo CONTENT;cat FILE)|/usr/lib/sendmail -t[/CODE] sendmail might be … | |
Re: Just so you know, they strongly discourage putting homework or work requests up oh this board. I don't run it; just thought you should know. That being said, all the other boards are dead, so : [CODE]#!/bin/ksh echo `uname -a` >>file.txt echo `hostname` >>file.txt echo $LOGNAME >>file.txt ls -d * … | |
Re: 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 | |
Re: Hey there, You could use the output of netstat and pipe that to a line count. Something like: netstat -an |grep "[2]3"|wc -l althought that might give you some false positives and you should echo the statement if you want to dump the out in a variable, since wc will … | |
Re: 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: [QUOTE]ps -ef | awk '/Cpu/ {if ($2 > 50 ) print "exceed"}'[/QUOTE] and assign it … | |
Re: Hey there, Sometimes it will work if you just replace your exec call with a simple direct call, so instead of: [QUOTE]exec $SHELL[/QUOTE] just do [QUOTE]$SHELL[/QUOTE] <-- Since you're not exec'ing (i.e. replacing the current process with your new process, you shouldn't get the session timeout error since you'll just … | |
Re: Hey there, This should work: [QUOTE]mkdir `date +%Y%m%d`[/QUOTE] Best wishes, Mike | |
Re: Hey There, Also, at the end of your code if you change: [CODE]echo "${name}:${phone}:${address}" >> addressbook.txt[/CODE] to [CODE]echo "${name}:${phone}:${address}" > addressbook.txt[/CODE] should inline replace the file. Hope that helps :) , Mike | |
Re: 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 incorrect. One thing I was thinking was that it might be easier to create the script to … | |
Re: 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: [QUOTE](echo 0;echo p;echo p)|format[/QUOTE] The partition print shows size in MB - You … | |
Re: Hey there, Just in case you have to do it the second way, this form works in bash 3.x (possibly earlier versions) and avoids the variable scoping problem while maintaining the integrity of the command you were feeding to the pipe. [CODE]while read j1 j2 j3 j4 fsize j5 j6 … | |
Re: Hey there, I'm sure what you're shooting for but, maybe: [CODE]LOG=${PROCS}.log $LOG "0"[/CODE] or [CODE]echo "0" >>$LOG[/CODE] Other than that, I'll need more specifics. Best wishes, Mike | |
Re: Hey there, If you're running syslog-ng, look into that. It has a history of doing exactly what you're experiencing. Otherwise, since you know this action is recurring (something is chmod'ing your /dev/null) you could just run this in cron with one line and just "assume" the permissions have been changed. … | |
Re: 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 def's twice If you change the last line of your function to: [CODE]sed 's/\$//' $dataFile|awk 'BEGIN{FS=","; RS="\n"} … | |
Re: Hey there, Just a word of practical advice. If you really "need" a solution and don't have time to wait for someone else to take of their own time to help you with your problem, try doing a search on google for something like: [QUOTE]script to remove extension from filename[/QUOTE] … | |
Re: Hey There, It might have to do with the user agent string that wget passes to the site (I think it's something like wget-version). You can manipulate the --user-agent= variable to pass anything, just be careful that you don't use Mozilla as they're litigation happy (more details on the options … | |
Re: Hey There, I am not sure what you want, exactly ;) Let me know if this is close: look through the entire events folder, find all the events subfolders and then gzip everything in those folders and place each gzipped file from each folder next to the corresponding subfolder in … | |
Re: Hey there, Very basicly, it's an integer used to identy an open file in a process. In Unix/Linux/Posix 0, 1 and 2 are generally reserved for STDIN (standard input), STDOUT (standard output) and STDERR (standard error), in that order. The integer (of file descriptor) are required as arguments to read, … | |
Re: Hey There, Another way to go about it would be to do the math incrementally, within the loop, to avoid any possibility of losing the variables value when you exit the loop due to scope issues. You can do this by using $c as your counter variable, as well, so … | |
Re: Also, as Salem pointed out, don't forget to use the preceding $ character when you're extracting values from your variables. Best wishes, Mike | |
Re: Hey there, 1. [CODE]#!/bin/bash # # your name # your course ls >FILE.txt[/CODE] 2. [CODE]#!/bin/bash # # your name # your course cp -r dir/* newdir/*[/CODE] Don't forget to chmod them at least 700 so they can be executed from the command line. Best wishes, , ike | |
Re: Hey There, You can also use "diff -r -y" if your version of diff supports it. This will give you output like: [QUOTE]$ ls a b a: a b c b: a a.gz b b.gz c.gz $ diff -y -r a b diff -y -r a/a b/a Only in b: … | |
Re: 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 had suggested. As Aia noted, it's never a good idea to overwrite … | |
Re: Hey there, For scripting in shell, you can just concatenate the two variables [QUOTE]sum="hi " host # number1="there" host # echo $sum hi host # sum="${sum}$number1" host # echo $sum hi there[/QUOTE] Hope that helps :) , Mike | |
Re: How does this work. Does the exe open up an xterm window and just run a command in there or are we looking at a full-blown gui? Thanks, Mike | |
Re: Not to be cute, but, yes :) As long as you know the format that you'll be entering the birthday's in your files (or multiple formats) you can extract them using any number of tools (sed, awk, etc), convert them into unix time, subtract that from the time right now … | |
Re: 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 split up: [CODE]lsof |grep QuarkXP|awk '{ print $9,$10,$11,$12 ]'|sed … | |
Re: Hey there, I don't know that there's any built-in way to do it, since, when you type the name of a file on the command line (an executable shell script, for instance), if you typed: [QUOTE]./script[/QUOTE] the shell would assume that you wanted to execute the script and would have … | |
Re: 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 you have "$ls" which you say equal $0, which is traditionally the command name if you're calling a script. So, … | |
Re: Hey there, What scripting language are you using? Or is that just pseudo-code? Seems to be a mix of a few different kinds and some of the statements may or may not be correct depending on the context. Look forward to your reply. Happy Holidays :) Quit working and relax … | |
Re: 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 for the batch file. If you're doing command line testing, although the variable MUST be %%A … | |
Re: If you want to restrict it to certain numberset, just frame floor and ceiling variables. For instance $RANDOM/600 will give you an approximate range of 0 to 60 (or 59, I forget). If you just fool around with that for a while, you should be able to tackle it. My … | |
Re: Hey There, You can catch tabs with sed using escape characters. So far tabs, you could match it with: [QUOTE]s '/test\t/d' <file[/QUOTE] Hope that helps and best wishes, Mike | |
Re: Hey there, One way to pass variables to awk (so you don't have to use double quotes) is with the -v flag, like [QUOTE]awk -v rBytes1=$rBytes '{......blah,blah,blah...}'[/QUOTE] and then you could use the variable rBytes1 in your script just like any other awk variable. Best wishes, Mike | |
Re: Hey there, Did I miss: [QUOTE]sed 1d FILENAME[/QUOTE] ? Just checking :) , Mike | |
Re: Hey there, I can see two places where this script might get you. 1. Since you create parts of some arrays by using the wildcard asterisk (*) you run the risk of creating really long lists which could give you a problem with programs like "rm" which tap out after … |
The End.