Re: bash script question

2009-12-01 Thread Dánielisz László
I just find out: #!/usr/local/bin/bash export IFS= cuc=$* mkdir cuc Thanks anyway! László From: Dánielisz László laszlo_daniel...@yahoo.com To: freebsd-questions@freebsd.org Sent: Tue, December 1, 2009 8:37:04 PM Subject: bash script question Hello, I'd

bash script question

2009-12-01 Thread Dánielisz László
Hello, I'd like to ask how can I read a variable in the same line when I launch a script? For example ./script.sh directory_name, and I want the script to creat the directory called directory_name or whatever I input there. Thank you! László ___

Re: bash script question

2009-12-01 Thread Polytropon
On Tue, 1 Dec 2009 11:48:43 -0800 (PST), Dánielisz László laszlo_daniel...@yahoo.com wrote: I just find out: #!/usr/local/bin/bash export IFS= cuc=$* mkdir cuc The $* variable will expand to all arguments given on the command line, e. g. $ ./myscript foo bar baz will result in

Re: bash script question

2009-12-01 Thread Rolf G Nielsen
script question Hello, I'd like to ask how can I read a variable in the same line when I launch a script? For example ./script.sh directory_name, and I want the script to creat the directory called directory_name or whatever I input there. Thank you! László

Re: bash script question

2009-12-01 Thread Polytropon
On Tue, 01 Dec 2009 21:06:34 +0100, Rolf G Nielsen laz...@lazlarlyricon.com wrote: Why are you using bash? To make a shell script as portable as possible, use /bin/sh. Bash is a third party shell, that isn't included in a base installation (you're not using bash as root's shell, are you?).

Re: bash script question

2009-12-01 Thread Gary Kline
On Tue, Dec 01, 2009 at 10:42:10PM +0100, Polytropon wrote: On Tue, 01 Dec 2009 21:06:34 +0100, Rolf G Nielsen laz...@lazlarlyricon.com wrote: Why are you using bash? To make a shell script as portable as possible, use /bin/sh. Bash is a third party shell, that isn't included in a base

Re: bash script question

2009-12-01 Thread Rolf G Nielsen
Gary Kline wrote: On Tue, Dec 01, 2009 at 10:42:10PM +0100, Polytropon wrote: On Tue, 01 Dec 2009 21:06:34 +0100, Rolf G Nielsen laz...@lazlarlyricon.com wrote: Why are you using bash? To make a shell script as portable as possible, use /bin/sh. Bash is a third party shell, that isn't

Re: bash script question

2009-12-01 Thread Polytropon
On Tue, 1 Dec 2009 13:45:55 -0800, Gary Kline kl...@thought.org wrote: Hi guys, Here's a bash-related question, kind-of. Is there any way to automagically run my .csrhc thru a script and wind up with a bash script? csh and (ba)sh use dufferent syntax and variable

Re: bash script question

2009-12-01 Thread Gary Kline
On Tue, Dec 01, 2009 at 11:02:07PM +0100, Rolf G Nielsen wrote: Gary Kline wrote: On Tue, Dec 01, 2009 at 10:42:10PM +0100, Polytropon wrote: On Tue, 01 Dec 2009 21:06:34 +0100, Rolf G Nielsen laz...@lazlarlyricon.com wrote: Why are you using bash? To make a shell script as portable as

Re: bash script question

2009-12-01 Thread Gary Kline
On Tue, Dec 01, 2009 at 11:10:33PM +0100, Polytropon wrote: On Tue, 1 Dec 2009 13:45:55 -0800, Gary Kline kl...@thought.org wrote: Hi guys, Here's a bash-related question, kind-of. Is there any way to automagically run my .csrhc thru a script and wind up with a bash

Re: Korn shell script Question

2007-02-02 Thread Dak Ghatikachalam
On 1/31/07, kris [EMAIL PROTECTED] wrote: On Wed, Jan 31, 2007 at 02:27:24PM -0500, Dak Ghatikachalam wrote: Thanks a lot , I test ran it. This is great No problem. I should add that if this is to be part of a long running script, you should close the co-process (the while-loop running cat),

Re: Korn shell script Question

2007-02-02 Thread Dak Ghatikachalam
On 1/31/07, kris [EMAIL PROTECTED] wrote: On Wed, Jan 31, 2007 at 02:27:24PM -0500, Dak Ghatikachalam wrote: Thanks a lot , I test ran it. This is great No problem. I should add that if this is to be part of a long running script, you should close the co-process (the while-loop running cat),

Re: Korn shell script Question

2007-02-02 Thread Kris Maglione
On Fri, Feb 02, 2007 at 11:10:02AM -0500, Dak Ghatikachalam wrote: { while cat /tmp/availspace.$$; do false; done } | exec 5p cat /tmp/reprocesses.$$|awk '/DATAFILE/ { print $0 }'|tr -d ' '| while read file_b do read -u5 file_a echo $file_b $file_a done /tmp/reprocessrecset.$$

Re: Korn shell script Question

2007-02-02 Thread Dak Ghatikachalam
On 2/2/07, Kris Maglione [EMAIL PROTECTED] wrote: On Fri, Feb 02, 2007 at 11:10:02AM -0500, Dak Ghatikachalam wrote: { while cat /tmp/availspace.$$; do false; done } | exec 5p cat /tmp/reprocesses.$$|awk '/DATAFILE/ { print $0 }'|tr -d ' '| while read file_b do read -u5 file_a

Korn shell script Question

2007-01-31 Thread Dak Ghatikachalam
Dear Freebsd'ers I have a an issue to address. in Korn Shell I have file_1 containing 1 2 3 4 and I have another file_2 containing A B C D E F G H I I have use these file_1 and file_2 and generate a file file_3 containing. A 1 B 2 C 3 D 4 E 1 F 2 G 3 H 4 I 1 I tried with several

Re: Korn shell script Question

2007-01-31 Thread Kris Maglione
On Wed, Jan 31, 2007 at 01:43:28PM -0500, Dak Ghatikachalam wrote: I tried with several looping for some reason I dont seem to get in right in Korn shell Any ideas on Ksh would be great, You can use any standard unix utilities to achieve this. Something to this effect should suffice, though

Re: Korn shell script Question

2007-01-31 Thread Dak Ghatikachalam
On 1/31/07, Kris Maglione [EMAIL PROTECTED] wrote: On Wed, Jan 31, 2007 at 01:43:28PM -0500, Dak Ghatikachalam wrote: I tried with several looping for some reason I dont seem to get in right in Korn shell Any ideas on Ksh would be great, You can use any standard unix utilities to achieve

Re: Korn shell script Question

2007-01-31 Thread kris
On Wed, Jan 31, 2007 at 02:27:24PM -0500, Dak Ghatikachalam wrote: Thanks a lot , I test ran it. This is great No problem. I should add that if this is to be part of a long running script, you should close the co-process (the while-loop running cat), with something like: exec 5p exec 5-

Another FBSD utility/script question

2006-11-15 Thread Jack Stone
Here I come with another easy one for most on the list -- except for me. I have 12,000 plus lines that have an empty line in between each real line, like so: this is a line of info 1 (empty) this is a line of info 2 this is a line of info 3 etc, etc To eliminate each empty line in between

Re: Another FBSD utility/script question

2006-11-15 Thread Vince
Hmm sed -e /^$/d FILENAME newfilename will do the job if they are empty lines. Vince Jack Stone wrote: Here I come with another easy one for most on the list -- except for me. I have 12,000 plus lines that have an empty line in between each real line, like so: this is a line of info 1

Re: Another FBSD utility/script question

2006-11-15 Thread N.J. Mann
On Wed 15 Nov 09:17, Jack Stone wrote: Here I come with another easy one for most on the list -- except for me. I have 12,000 plus lines that have an empty line in between each real line, like so: [...] grep -v '^$' Cheers, Nick. -- With sufficient thrust, pigs fly just fine.

gnome_upgrade script question

2005-11-14 Thread dick hoogendijk
I have a spare 6.0 computer on which I ran the gnome_upgrade script. My g** .. 47 ports were deleted amongst which are very big ones like mozilla and all of KDE. This will take me a very long time to rebuild. And this only because glib2 is changed? I don't like this at all. It's a brandnew 6.0

Re: gnome_upgrade script question

2005-11-14 Thread Kent Stewart
On Monday 14 November 2005 12:20 pm, dick hoogendijk wrote: I have a spare 6.0 computer on which I ran the gnome_upgrade script. My g** .. 47 ports were deleted amongst which are very big ones like mozilla and all of KDE. This will take me a very long time to rebuild. And this only because

Shell script question

2005-08-04 Thread Paul Schmehl
I'm working on a shell script to use p0f to identify unauthorized hosts on our network. In the script I use an echo command to see what the output of the command is. This is what it looks like: /usr/local/bin/p0f -i xl0 -N -l -o /root/capture.1123177152.log 'src net 10.0.0.0/8 or src net

Re: Shell script question

2005-08-04 Thread Paul Schmehl
--On Thursday, August 04, 2005 12:46:20 -0500 Paul Schmehl [EMAIL PROTECTED] wrote: I'm working on a shell script to use p0f to identify unauthorized hosts on our network. In the script I use an echo command to see what the output of the command is. This is what it looks like:

Shell script question

2005-02-17 Thread Digish Reshamwala
Hi, I am trying to run one of my installation shell script using the command- bash resetapp.sh it gives me the error as- 'bash: not found' How do I install bash? I am using FreeBSD/i3b6 5.2.1 Also, whats the command to check which version of FreeBSD I am using? Please help me out, Thanks a

Re: Shell script question

2005-02-17 Thread JarJarBings
Hi, simply go to /usr/ports/shells/bash2 and type make install uname -a will give you the version infos needed. regards Digish Reshamwala wrote: Hi, I am trying to run one of my installation shell script using the command- bash resetapp.sh it gives me the error as- 'bash: not found' How do I

Re: Shell script question

2005-02-17 Thread Tim Erlin
Digish Reshamwala wrote: Hi, Hi. How do I install bash? I am using FreeBSD/i3b6 5.2.1 There are several ways to install software. The handbook deals with them quite extensively: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports.html 'man pkg_add' might also be of help. If your

Re: Shell script question

2005-02-17 Thread Doug Poland
On Thu, Feb 17, 2005 at 01:13:49PM -0800, Digish Reshamwala wrote: Hi, I am trying to run one of my installation shell script using the command- bash resetapp.sh it gives me the error as- 'bash: not found' How do I install bash? I am using FreeBSD/i3b6 5.2.1 pkg_add -r bash

Re: Shell script question

2005-02-17 Thread Eric F Crist
On Feb 17, 2005, at 3:13 PM, Digish Reshamwala wrote: Hi, I am trying to run one of my installation shell script using the command- bash resetapp.sh it gives me the error as- 'bash: not found' How do I install bash? I am using FreeBSD/i3b6 5.2.1 Also, whats the command to check which version

Re: Shell script question

2005-02-17 Thread Michael C. Shultz
On Thursday 17 February 2005 01:13 pm, Digish Reshamwala wrote: Hi, I am trying to run one of my installation shell script using the command- bash resetapp.sh it gives me the error as- 'bash: not found' How do I install bash? I am using FreeBSD/i3b6 5.2.1 Bash is in ports, try

Re: perl script question.

2004-01-26 Thread Gary Kline
On Sat, Jan 10, 2004 at 11:02:18PM +, Matthew Seaman wrote: On Sat, Jan 10, 2004 at 11:39:07PM +0100, Björn Andersson wrote: On Sat, Jan 10, 2004 at 10:33:08PM +, Matthew Seaman wrote: On Sat, Jan 10, 2004 at 02:10:36PM -0800, Gary Kline wrote: Folks,

Script question...

2004-01-12 Thread Xpression
Hi list, I've making a script to write the content of three text files to one file, but I want to separate each files by a delimiter like the name of the file. This is the script: #! /bin/sh path=/some/dir if !([ -f $path/this.one ]); then for file in $path/file1 $path/file2 $path/file3; do

Re: Script question...

2004-01-12 Thread Julien Gabel
Hi list, I've making a script to write the content of three text files to one file, but I want to separate each files by a delimiter like the name of the file. Maybe this little sh(1) script can do the job: # = begin.script = #! /bin/sh

Re: Script question...

2004-01-12 Thread Andrew L. Gould
On Monday 12 January 2004 05:04 pm, Xpression wrote: Hi list, I've making a script to write the content of three text files to one file, but I want to separate each files by a delimiter like the name of the file. This is the script: #! /bin/sh path=/some/dir if !([ -f $path/this.one ]);

Re: Script question...

2004-01-12 Thread Charles Swiger
On Jan 12, 2004, at 6:04 PM, Xpression wrote: [ ...a question on how to change a shell script... ] Try: #! /bin/sh path=/some/dir if !([ -f $path/this.one ]); then touch $path/this.one for file in $path/file1 $path/file2 $path/file3; do echo

Re: perl script question.

2004-01-11 Thread Bernard El-Hagin
Matthew Seaman wrote: On Sat, Jan 10, 2004 at 06:26:30PM -0500, Marty Landman wrote: At 06:02 PM 1/10/2004, Matthew Seaman wrote: On Sat, Jan 10, 2004 at 11:39:07PM +0100, Bj?rn Andersson wrote: If this occures more than once on a line we should have the line as this: perl -pi.bak

Re: perl script question.

2004-01-11 Thread Matthew Seaman
On Sat, Jan 10, 2004 at 05:34:34PM -0800, Gary Kline wrote: On Sat, Jan 10, 2004 at 11:02:18PM +, Matthew Seaman wrote: perl -pi.bak -e 's/\s*\w+_\w+\.?//g;' filename The lines do indeed wrap so this does the job on a test file. I do have the re-exp book but this one is

Re: perl script question.

2004-01-11 Thread Gary Kline
On Sun, Jan 11, 2004 at 11:52:37AM +, Matthew Seaman wrote: On Sat, Jan 10, 2004 at 05:34:34PM -0800, Gary Kline wrote: On Sat, Jan 10, 2004 at 11:02:18PM +, Matthew Seaman wrote: perl -pi.bak -e 's/\s*\w+_\w+\.?//g;' filename The lines do indeed wrap so this does the

perl script question.

2004-01-10 Thread Gary Kline
Folks, Let's see if perl can do this one; it's as obscure a task as I've run into. I have scores of files with: A regular sentence, or phrase. then_one_containing_underscores_- between_each_word Followed by another regular, space-delimited

Re: perl script question.

2004-01-10 Thread Bernard El-Hagin
Gary Kline wrote: Folks, Let's see if perl can do this one; it's as obscure a task as I've run into. I have scores of files with: A regular sentence, or phrase. then_one_containing_underscores_- between_each_word Followed by another regular,

Re: perl script question.

2004-01-10 Thread Matthew Seaman
On Sat, Jan 10, 2004 at 02:10:36PM -0800, Gary Kline wrote: Folks, Let's see if perl can do this one; it's as obscure a task as I've run into. I have scores of files with: A regular sentence, or phrase. then_one_containing_underscores_- between_each_word

Re: perl script question.

2004-01-10 Thread Björn Andersson
If this occures more than once on a line we should have the line as this: perl -pi.bak -e 's/\s+\w+_\w+\.?//g;' filename Notice the added g. :-) On Sat, Jan 10, 2004 at 10:33:08PM +, Matthew Seaman wrote: On Sat, Jan 10, 2004 at 02:10:36PM -0800, Gary Kline wrote: Folks,

Re: perl script question.

2004-01-10 Thread Matthew Seaman
On Sat, Jan 10, 2004 at 11:39:07PM +0100, Björn Andersson wrote: On Sat, Jan 10, 2004 at 10:33:08PM +, Matthew Seaman wrote: On Sat, Jan 10, 2004 at 02:10:36PM -0800, Gary Kline wrote: Folks, Let's see if perl can do this one; it's as obscure a task as I've run into. I

Re: perl script question.

2004-01-10 Thread Marty Landman
At 06:02 PM 1/10/2004, Matthew Seaman wrote: On Sat, Jan 10, 2004 at 11:39:07PM +0100, Björn Andersson wrote: If this occures more than once on a line we should have the line as this: perl -pi.bak -e 's/\s+\w+_\w+\.?//g;' filename Good point. Also, if the stuff_separated_by_underscores wraps

Re: perl script question.

2004-01-10 Thread Matthew Seaman
On Sat, Jan 10, 2004 at 06:26:30PM -0500, Marty Landman wrote: At 06:02 PM 1/10/2004, Matthew Seaman wrote: On Sat, Jan 10, 2004 at 11:39:07PM +0100, Björn Andersson wrote: If this occures more than once on a line we should have the line as this: perl -pi.bak -e 's/\s+\w+_\w+\.?//g;'

Re: perl script question.

2004-01-10 Thread Marty Landman
At 06:36 PM 1/10/2004, Matthew Seaman wrote: Err --- Gary Kline was the OP asking how to do this: I think you mean Bernard El-Hagin's solution? % perl -i.bak -pe 'tr/_/ /' files That doesn't do the right thing. Woops, not only can't I read the question right, can't read the poster's name

Re: perl script question.

2004-01-10 Thread Gary Kline
On Sat, Jan 10, 2004 at 11:36:45PM +, Matthew Seaman wrote: On Sat, Jan 10, 2004 at 06:26:30PM -0500, Marty Landman wrote: At 06:02 PM 1/10/2004, Matthew Seaman wrote: On Sat, Jan 10, 2004 at 11:39:07PM +0100, Björn Andersson wrote: If this occures more than once on a line we should

Re: Cvsup script question

2003-08-25 Thread Marco Gonçalves
: [EMAIL PROTECTED] Sent: Friday, August 22, 2003 4:24 PM Subject: Re: Cvsup script question Charles Howse [EMAIL PROTECTED] writes: Hi, I'm cvsup'ing from a script in /usr/local/etc/periodic/daily. Here 'tis: #!/usr/local/bin/bash Echo Echo Output of cvsup: /usr/local

Re: Cvsup script question

2003-08-25 Thread Joshua Oreman
On Mon, Aug 25, 2003 at 03:32:25PM +0100 or thereabouts, Marco Gon?alves wrote: Hi, i did some minor alterations to the script by #!/usr/local/bin/bash /usr/local/bin/cvsup -g -L 0 /etc/cvsupfile # Keep quiet except for errors /usr/local/sbin/portsdb -Uu /dev/null # Hopefully, show

Re: Cvsup script question

2003-08-22 Thread Lowell Gilbert
Charles Howse [EMAIL PROTECTED] writes: Hi, I'm cvsup'ing from a script in /usr/local/etc/periodic/daily. Here 'tis: #!/usr/local/bin/bash Echo Echo Output of cvsup: /usr/local/bin/cvsup -g -L 2 /etc/cvsupfile Echo Echo Output of portsdb: /usr/local/sbin/portsdb -Uu Echo Echo Output

Cvsup script question

2003-08-21 Thread Charles Howse
Hi, I'm cvsup'ing from a script in /usr/local/etc/periodic/daily. Here 'tis: #!/usr/local/bin/bash Echo Echo Output of cvsup: /usr/local/bin/cvsup -g -L 2 /etc/cvsupfile Echo Echo Output of portsdb: /usr/local/sbin/portsdb -Uu Echo Echo Output of portversion: /usr/local/sbin/portversion It

Re: sending mail with a script question

2003-04-05 Thread Ken McGlothlen
David Banning [EMAIL PROTECTED] writes: | I am running a php program in a browser which eventually compiles some files | and emails them to a person of their choosing. The problem is that the system | identifies the browser user as nobody. | | I send the mail using a line something like; | |

Re: sending mail with a script question

2003-04-05 Thread Giorgos Keramidas
On 2003-04-04 23:45, David Banning [EMAIL PROTECTED] wrote: I am running a php program in a browser which eventually compiles some files and emails them to a person of their choosing. The problem is that the system identifies the browser user as nobody. I send the mail using a line something

Re: sending mail with a script question

2003-04-05 Thread David Banning
system is nobody. Try this: cat textfile | \ mutt -s Subject here \ -x -e 'set envelope_from=yes' -e 'my_hdr From: [EMAIL PROTECTED]' \ -a attachment1 -a attachment2 \ [EMAIL PROTECTED] The change is the addition of the two -e options

Re: sending mail with a script question

2003-04-05 Thread David Banning
Have you considered using php's mail function? You can specify a sender by specifying headers. Bill, I never even considered this even as a possibility. Thanks for the tip. ___ [EMAIL PROTECTED] mailing list

Re: sending mail with a script question

2003-04-05 Thread Bill Moran
David Banning wrote: I am running a php program in a browser which eventually compiles some files and emails them to a person of their choosing. The problem is that the system identifies the browser user as nobody. I send the mail using a line something like; cat textfile | mutt

sending mail with a script question

2003-04-04 Thread David Banning
I am running a php program in a browser which eventually compiles some files and emails them to a person of their choosing. The problem is that the system identifies the browser user as nobody. I send the mail using a line something like; cat textfile | mutt -sQuote/Attachments -afile1 -afile2

Re: sending mail with a script question

2003-04-04 Thread David Banning
cat textfile | mutt -sQuote/Attachments -afile1 -afile2 [EMAIL PROTECTED] but the problem is that the recipient sees the sender address as from [EMAIL PROTECTED], when I want it seen as [EMAIL PROTECTED]. I have the name of the user available in the script but I see no way of running

Re: sending mail with a script question

2003-04-04 Thread David Banning
I do use Exim and all I have to tell it is: trusted_users = www It would then allow the webserver to set the correct address. I am not sure how Sendmail, Postfix or any other MTA does this. Thanks for the idea. Sendmail is a bit of a nightmare to tangle with, but I'll start looking around

Re: sending mail with a script question

2003-04-04 Thread Matthew Seaman
On Sat, Apr 05, 2003 at 02:20:54AM -0500, David Banning wrote: I do use Exim and all I have to tell it is: trusted_users = www It would then allow the webserver to set the correct address. I am not sure how Sendmail, Postfix or any other MTA does this. Thanks for the idea.