Multiple mount_smbfs commands fail in bash script

2010-09-02 Thread Bernard Scharp
Hi all, I'm having some problems with a bash script. It's a backup script that periodically checks if a list of systems is online, and if so, uses samba to mount a specified list of shares, rsyncs them to a local directory and unmounts again. This used to run fine till a few months ago (I don't

Re: Multiple mount_smbfs commands fail in bash script

2010-09-02 Thread Jerry
On Thu, 02 Sep 2010 10:24:05 +0200 Bernard Scharp freebsd-questi...@itsacon.net articulated: Hi all, I'm having some problems with a bash script. It's a backup script that periodically checks if a list of systems is online, and if so, uses samba to mount a specified list of shares

Re: Multiple mount_smbfs commands fail in bash script

2010-09-02 Thread Bernard Scharp
Could you post the script? Anything else would be pure guess work. You Well, I can recreate it with something as simple as: #!/usr/local/bin/bash mount_smbfs //u...@remotehost/share1/ /tmp/mnt/ mount_smbfs //u...@remotehost/share2/ /tmp/mnt2/ also might consider posting this on the BASH

Re: Multiple mount_smbfs commands fail in bash script

2010-09-02 Thread Polytropon
On Thu, 02 Sep 2010 14:02:35 +0200, Bernard Scharp freebsd-questi...@itsacon.net wrote: Could you post the script? Anything else would be pure guess work. You Well, I can recreate it with something as simple as: #!/usr/local/bin/bash mount_smbfs //u...@remotehost/share1/ /tmp/mnt/

Re: Multiple mount_smbfs commands fail in bash script

2010-09-02 Thread Bernard Scharp
On 02/09/2010 15:29, Polytropon wrote: On Thu, 02 Sep 2010 14:02:35 +0200, Bernard Scharp freebsd-questi...@itsacon.net wrote: Could you post the script? Anything else would be pure guess work. You Well, I can recreate it with something as simple as: #!/usr/local/bin/bash mount_smbfs

Re: Multiple mount_smbfs commands fail in bash script

2010-09-02 Thread Polytropon
On Thu, 02 Sep 2010 15:52:25 +0200, Bernard Scharp freebsd-questi...@itsacon.net wrote: Neither am I. Hadn't even thought of grepping in /usr/src for the error message :-) It's often a good starting point to see where problems might be caused from. Can I just `rm /dev/nsmbX` them? (messing

Bash Script Help - File Names With Spaces

2010-08-17 Thread Drew Tomlinson
I have a collection of yearly top 100 Billboard mp3s in this format (all one line - sorry if it wraps): /archive/Multimedia/Audio/Music/Billboard Top USA Singles/1980-028 Kenny Loggins - This Is It.mp3 I want to create symbolic links to the top 30 in 1966-1969 in another directory for easy

Re: Bash Script Help - File Names With Spaces

2010-08-17 Thread Chip Camden
Quoth Drew Tomlinson on Tuesday, 17 August 2010: I have a collection of yearly top 100 Billboard mp3s in this format (all one line - sorry if it wraps): /archive/Multimedia/Audio/Music/Billboard Top USA Singles/1980-028 Kenny Loggins - This Is It.mp3 I want to create symbolic links to

Re: Bash Script Help - File Names With Spaces -- SOLVED

2010-08-17 Thread Drew Tomlinson
On 8/17/2010 7:47 AM, Drew Tomlinson wrote: I have a collection of yearly top 100 Billboard mp3s in this format (all one line - sorry if it wraps): /archive/Multimedia/Audio/Music/Billboard Top USA Singles/1980-028 Kenny Loggins - This Is It.mp3 I want to create symbolic links to the top 30

Re: Bash Script Help - File Names With Spaces

2010-08-17 Thread Drew Tomlinson
On 8/17/2010 8:22 AM, Chip Camden wrote: Quoth Drew Tomlinson on Tuesday, 17 August 2010: I have a collection of yearly top 100 Billboard mp3s in this format (all one line - sorry if it wraps): /archive/Multimedia/Audio/Music/Billboard Top USA Singles/1980-028 Kenny Loggins - This Is

Re: Bash Script Help - File Names With Spaces

2010-08-17 Thread Timm Wimmers
Am Dienstag, den 17.08.2010, 08:22 -0700 schrieb Chip Camden: find -E ... | while read i; do; basename $i; done The semicolon behind do isn't necessary. -- Timm ___ freebsd-questions@freebsd.org mailing list

Re: Bash Script Help - File Names With Spaces

2010-08-17 Thread Karl Vogel
On Tue, 17 Aug 2010 07:47:25 -0700, Drew Tomlinson d...@mykitchentable.net said: D Then I attempt to use 'basename' to extract the file name to a variable D which I can later pass to 'ln'. This seems to work: D basename /archive/Multimedia/Audio/Music/Billboard Top USA D Singles/1980-028

Re: Bash Script Help - File Names With Spaces -- SOLVED

2010-08-17 Thread Anonymous
Drew Tomlinson d...@mykitchentable.net writes: It finally occurred to me that I needed the shell to see a new line as the delimiter and not whitespace. Then a simple search revealed my answer: O=$IFS IFS=$(echo -en \n\b) do stuff IFS=$O Old IFS value can be preserved by using `local'

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
Dánielisz László wrote: 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

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
that are bash-only. 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? gary -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe

Re: bash script question

2009-12-01 Thread Rolf G Nielsen
that are bash-only. 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? gary -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa

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
for maximal portability. Use sh if you're not requiring features that are bash-only. 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? gary -- Polytropon

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: SUID permission on Bash script

2009-08-30 Thread Matthew Seaman
per...@pluto.rain.com wrote: RW rwmailli...@googlemail.com wrote: On Sat, 29 Aug 2009 00:06:29 -0700 per...@pluto.rain.com wrote: Actually, absent some careful cooperation between the kernel and the interpreter to prevent a race condition ... isn't that the same issue that Matthew Seaman was

Re: SUID permission on Bash script

2009-08-30 Thread perryh
Matthew Seaman m.sea...@infracaninophile.co.uk wrote: It would do no good for the kernel to hand the interpreter an open descriptor if the interpreter did not somehow know to read the script from that open descriptor instead of opening the script file by name. Errr -- no. That's what

Re: SUID permission on Bash script

2009-08-29 Thread perryh
Michael David Crawford m...@prgmr.com wrote: It's not that setuid shell scripts are really more inherently insecure than programs written in C. Actually, absent some careful cooperation between the kernel and the interpreter to prevent a race condition that can cause the interpreter to run

Re: SUID permission on Bash script

2009-08-29 Thread Michael David Crawford
per...@pluto.rain.com wrote: Actually, absent some careful cooperation between the kernel and the interpreter to prevent a race condition that can cause the interpreter to run (with elevated permissions) a completely different script than the one that was marked setuid, setuid scripts _are_

Re: SUID permission on Bash script

2009-08-29 Thread Giorgos Keramidas
On Sat, 29 Aug 2009 00:17:24 -0700, Michael David Crawford m...@prgmr.com wrote: I came across a page that explained all the different ways setuid scripts could screw up - one would have to be a rocket scientist to avoid all the potential pitfalls. Hi Michael, It would be a very useful

Re: SUID permission on Bash script

2009-08-29 Thread RW
On Sat, 29 Aug 2009 00:06:29 -0700 per...@pluto.rain.com wrote: Michael David Crawford m...@prgmr.com wrote: It's not that setuid shell scripts are really more inherently insecure than programs written in C. Actually, absent some careful cooperation between the kernel and the interpreter

Re: SUID permission on Bash script

2009-08-29 Thread Jerry McAllister
On Fri, Aug 28, 2009 at 08:10:59PM -0600, Tim Judd wrote: On 8/28/09, RW rwmailli...@googlemail.com wrote: On Fri, 28 Aug 2009 11:54:19 +0300 Giorgos Keramidas keram...@ceid.upatras.gr wrote: On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo jeronimocal...@googlemail.com wrote:

Re: SUID permission on Bash script

2009-08-29 Thread Matthew Seaman
RW wrote: On Sat, 29 Aug 2009 00:06:29 -0700 per...@pluto.rain.com wrote: Michael David Crawford m...@prgmr.com wrote: It's not that setuid shell scripts are really more inherently insecure than programs written in C. Actually, absent some careful cooperation between the kernel and the

Re: SUID permission on Bash script

2009-08-29 Thread Michael David Crawford
Perhaps a better idea than a setuid shell script, would be to figure out just what it is about your script that really needs to be executed as root. When write a C program that can do just that one thing - and absolutely nothing else. If it takes any kind of input, or command line

Re: SUID permission on Bash script

2009-08-29 Thread perryh
RW rwmailli...@googlemail.com wrote: On Sat, 29 Aug 2009 00:06:29 -0700 per...@pluto.rain.com wrote: Actually, absent some careful cooperation between the kernel and the interpreter to prevent a race condition ... isn't that the same issue that Matthew Seaman was saying was fixed years

SUID permission on Bash script

2009-08-28 Thread Jeronimo Calvo
Hi folks! Im trying to set up a reaaallly basic scrip to allow one user to shutdown my machine without root permisions, seting up SUID as follows: -rwsrwxr-- 1 root wheel 38 Aug 27 23:12 apagar.sh $ ./apagar.sh Permission denied content of script: cat apagar.sh ]#!/usr/local/bin/bash

Re: SUID permission on Bash script

2009-08-28 Thread Giorgos Keramidas
On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo jeronimocal...@googlemail.com wrote: Hi folks! Im trying to set up a reaaallly basic scrip to allow one user to shutdown my machine without root permisions, seting up SUID as follows: -rwsrwxr-- 1 root wheel 38 Aug 27 23:12 apagar.sh $

Re: SUID permission on Bash script

2009-08-28 Thread Jeronimo Calvo
Aham! so SUID can be applied to sh but it doesn't work!, there is not anyway to apply it? apart from installing sudo?, The thing is that installing sudo and adding that user into sudoers, that user will be capable to do any other SU tasks, apart of shutting down... wich i dont like :D (I know

Re: SUID permission on Bash script

2009-08-28 Thread Jonathan McKeown
On Friday 28 August 2009 10:54:19 Giorgos Keramidas wrote: On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo jeronimocal...@googlemail.com wrote: Hi folks! Im trying to set up a reaaallly basic scrip to allow one user to shutdown my machine without root permisions, seting up SUID as

Re: SUID permission on Bash script

2009-08-28 Thread George Davidovich
On Fri, Aug 28, 2009 at 10:01:54AM +0100, Jeronimo Calvo wrote: 2009/8/28 Giorgos Keramidas keram...@ceid.upatras.gr On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo jeronimocal...@googlemail.com wrote: Im trying to set up a reaaallly basic scrip to allow one user to shutdown my

Re: SUID permission on Bash script

2009-08-28 Thread Polytropon
On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo jeronimocal...@googlemail.com wrote: content of script: ]#!/usr/local/bin/bash ^ This ] doesn't belong to the script, does it? Furthermore, why do you employ bash for calling another program? It's standard to use sh (#!/bin/sh) if you don't

Re: SUID permission on Bash script

2009-08-28 Thread RW
On Fri, 28 Aug 2009 11:54:19 +0300 Giorgos Keramidas keram...@ceid.upatras.gr wrote: On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo jeronimocal...@googlemail.com wrote: As far as i know, using SUID, script must runs with root permissions... so i shoudnt get Permission denied, what im

Re: SUID permission on Bash script

2009-08-28 Thread Tim Judd
On 8/28/09, RW rwmailli...@googlemail.com wrote: On Fri, 28 Aug 2009 11:54:19 +0300 Giorgos Keramidas keram...@ceid.upatras.gr wrote: On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo jeronimocal...@googlemail.com wrote: As far as i know, using SUID, script must runs with root

Re: SUID permission on Bash script

2009-08-28 Thread Polytropon
On Fri, 28 Aug 2009 20:10:59 -0600, Tim Judd taj...@gmail.com wrote: Dunno, but this dawns on me.. what defines a script? I've always defined a script that starts with a #! shebang. So the script can be SUID, but the interpreter/shell isn't. Is that why it doesn't work? What is the

Re: SUID permission on Bash script

2009-08-28 Thread Giorgos Keramidas
On Sat, 29 Aug 2009 02:24:31 +0100, RW rwmailli...@googlemail.com wrote: On Fri, 28 Aug 2009 11:54:19 +0300 Giorgos Keramidas keram...@ceid.upatras.gr wrote: On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo jeronimocal...@googlemail.com wrote: As far as i know, using SUID, script must runs

Re: SUID permission on Bash script

2009-08-28 Thread Michael David Crawford
RW wrote: So are scripts actually incapable of running setuid? They aren't on Linux. I learned about that a while back when I investigated setuid scripts for a coworker. It's not that setuid shell scripts are really more inherently insecure than programs written in C. The problem is more

Problem with bash script

2009-06-16 Thread Carmel NY
I am attempting to write a simple Bash script that will find all the '*.pem' files in a directory structure and move them to another directory. It seems to work until I get to the copy part where it fails. My scripting skills are not that good. Perhaps someone could tell me what I am doing wrong

Re: Problem with bash script

2009-06-16 Thread Bertram Scharpf
Hi, Am Dienstag, 16. Jun 2009, 09:09:09 -0400 schrieb Carmel NY: [...] It seems to work until I get to the copy part where it fails. My scripting skills are not that good. Perhaps someone could tell me what I am doing wrong. # copy the file to another directory using the base name cp $i

Re: Problem with bash script

2009-06-16 Thread Moises Castellanos
Hi Carmel On Wed, Jun 17, 2009 at 8:39 AM, Carmel NY carmel...@hotmail.com wrote: I am attempting to write a simple Bash script that will find all the '*.pem' files in a directory structure and move them to another directory. It seems to work until I get to the copy part where it fails. My

Re: Problem with bash script

2009-06-16 Thread Daniel Underwood
$ find ./ -name *.pem -exec cp {} /usr/home/tmp/something \; I'm a novice with shell scripting myself, but what's the difference between that code and some variant thereof using a pipe and xargs? Are they simply two different ways of achieving the same result? Or is there some more important

Re: Problem with bash script

2009-06-16 Thread Carmel NY
On Tue, 16 Jun 2009 15:56:15 +0200 Bertram Scharpf li...@bertram-scharpf.de wrote: Hi, Am Dienstag, 16. Jun 2009, 09:09:09 -0400 schrieb Carmel NY: [...] It seems to work until I get to the copy part where it fails. My scripting skills are not that good. Perhaps someone could tell me

Re: Problem with bash script

2009-06-16 Thread Paul Schmehl
--On Tuesday, June 16, 2009 08:09:09 -0500 Carmel NY carmel...@hotmail.com wrote: I am attempting to write a simple Bash script that will find all the '*.pem' files in a directory structure and move them to another directory. It seems to work until I get to the copy part where it fails. My

Re: Problem with bash script

2009-06-16 Thread Daniel Bye
On Tue, Jun 16, 2009 at 02:33:37PM +, Paul Schmehl wrote: --On Tuesday, June 16, 2009 08:09:09 -0500 Carmel NY carmel...@hotmail.com wrote: I am attempting to write a simple Bash script that will find all the '*.pem' files in a directory structure and move them to another directory

Re: Problem with bash script

2009-06-16 Thread Matthew Seaman
Carmel NY wrote: I am attempting to write a simple Bash script that will find all the '*.pem' files in a directory structure and move them to another directory. It seems to work until I get to the copy part where it fails. My scripting skills are not that good. Perhaps someone could tell me

Re: Problem with bash script

2009-06-16 Thread Mel Flynn
On Tuesday 16 June 2009 06:03:33 Daniel Underwood wrote: $ find ./ -name *.pem -exec cp {} /usr/home/tmp/something \; I'm a novice with shell scripting myself, but what's the difference between that code and some variant thereof using a pipe and xargs? Are they simply two different ways of

Re: Problem with bash script

2009-06-16 Thread Karl Vogel
On Tuesday, June 16, 2009 08:09:09 -0500 Carmel NY carmel...@hotmail.com wrote: C I am attempting to write a simple Bash script that will find all the C '*.pem' files in a directory structure and move them to another C directory. Using find and pax will correctly handle filenames

Re: Problem with bash script

2009-06-16 Thread Karl Vogel
I botched the filter example in my previous blathering. This will ignore output from find containing patterns: root# find . -depth -print | fgrep -v -f /some/patterns Leaving off the -v will keep output containing those patterns. -- Karl Vogel I don't speak for the USAF

Re: bash script on FreeBSD

2008-10-08 Thread Artis Caune
100 admin2 has uid 200 admin3 has uid 300 admin4 has uid 400 How do I make this with bash script? # echo $line |awk '{ print $1 has uid $2 }' -- regards, Artis Caune . CCNA | BSDA | ' didii FreeBSD ___ freebsd

Re: bash script on FreeBSD

2008-10-08 Thread Frank Shute
: admin has uid 100 admin2 has uid 200 admin3 has uid 300 admin4 has uid 400 How do I make this with bash script? Thank you Kalpin Erlangga Silaen $ sed -e 's/\(admin[0-9]*\)\ \([0-9]*\)/\1 has uid \2/g' /etc/passwd Regards, -- Frank Contact info: http://www.shute.org.uk/misc

Re: bash script on FreeBSD

2008-10-08 Thread Frank Shute
admin3 300 admin4 400 and then I want to echoing into screen: admin has uid 100 admin2 has uid 200 admin3 has uid 300 admin4 has uid 400 How do I make this with bash script? Thank you Kalpin Erlangga Silaen $ sed -e 's/\(admin[0-9]*\)\ \([0-9]*\)/\1 has uid \2/g

Re: bash script on FreeBSD

2008-10-08 Thread Kalpin Erlangga Silaen
to extract field username and UID from /etc/passwd and passed into some scripts. Let say I got line admin 100 admin2 200 admin3 300 admin4 400 and then I want to echoing into screen: admin has uid 100 admin2 has uid 200 admin3 has uid 300 admin4 has uid 400 How do I make this with bash script? Thank you

Re: bash script on FreeBSD

2008-10-08 Thread Giorgos Keramidas
into screen: admin has uid 100 admin2 has uid 200 admin3 has uid 300 admin4 has uid 400 How do I make this with bash script? You don't really need bash for this. Here's a sample awk script that should work: % cat -n /tmp/userlist.awk 1 #!/usr/bin/awk -f 2 3

Re: bash script on FreeBSD

2008-10-08 Thread Paul Schmehl
line admin 100 admin2 200 admin3 300 admin4 400 and then I want to echoing into screen: admin has uid 100 admin2 has uid 200 admin3 has uid 300 admin4 has uid 400 How do I make this with bash script? You don't really need bash for this. Here's a sample awk script that should work: % cat

bash script on FreeBSD

2008-10-07 Thread Kalpin Erlangga Silaen
this with bash script? Thank you Kalpin Erlangga Silaen ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]

Re: Bash script to find out the summary of user memory usage [not working]

2007-12-17 Thread Patrick Dung
I have correction with the script but still doesn't work: #!/usr/local/bin/bash for user in `ps -A -o user | sort | uniq | tail +2` do echo user: $user ps aux -U $user | tail +2 | while read line do mem=`echo $line | awk {'print $4'}` echo mem: $mem

Re: Bash script to find out the summary of user memory usage [not working]

2007-12-17 Thread Giorgos Keramidas
On 2007-12-17 06:00, Patrick Dung [EMAIL PROTECTED] wrote: I have correction with the script but still doesn't work: #!/usr/local/bin/bash for user in `ps -A -o user | sort | uniq | tail +2` do echo user: $user ps aux -U $user | tail +2 | while read line do mem=`echo

Bash script to find out the summary of user memory usage [not working]

2007-12-14 Thread Patrick Dung
Hello, any idea about why below script is not working? The final sum is empty.. #!/usr/local/bin/bash for user in `ps -A -o user | sort | uniq | tail +2` do echo user: $user ps aux -U $user | tail +2 | while read line do mem=`echo $line | awk {'print $4'}` echo mem:

need help w/ simple bash script

2006-06-27 Thread dw
Hi all, I am trying to write a simple bash script that will collate pkg_version reports from all of my servers to generate centralized HTML reports. To format the output, I am trying: # REPORT=`pkg_version -v` But when I echo $REPORT, I get: Xaw3d-1.5E_1 = up-to-date with port apr-db42

Re: need help w/ simple bash script

2006-06-27 Thread Paul Chvostek
Hiya. I've been working on a web front-end to aggregate multiple servers' package update requirements as well. I'll probably have it ready to present in another few weeks, if ${DAYJOB} doesn't get in the way. On Tue, Jun 27, 2006 at 08:01:49AM -0400, dw wrote: # REPORT=`pkg_version -v`

RE: need help w/ simple bash script

2006-06-27 Thread [EMAIL PROTECTED]@mgedv.net
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of dw Sent: Tuesday, June 27, 2006 2:02 PM To: freebsd-questions@freebsd.org Subject: need help w/ simple bash script Hi all, I am trying to write a simple bash script that will collate

Re: bash script

2005-08-21 Thread Nagilum
[EMAIL PROTECTED] wrote: My knowledge in bash scripting is about medium not very advanced and all so I am not attempting to make a connection limiter but what I want to make is a script that checks the irc connections off a certain user and takes some actions, mostly of this I know how to do

Re: Help on bash script?

2005-08-13 Thread Ian Smith
On Sat, 13 Aug 2005, Giorgos Keramidas wrote: On 2005-08-12 13:38, Benson Wong [EMAIL PROTECTED] wrote: I prefer: for COREFILE in `find / -type f -name core -print` do ... done Wouldn't that accomplish the same thing? More or less. Less, when the filenames are

Help on bash script?

2005-08-12 Thread Ian Smith
On Fri 12 Aug 2005 09:33:54 +0800 Xu Qiang [EMAIL PROTECTED] wrote: find / -type f -name core -print | while read COREFILE ; do NCOREFILES=$[ $NCOREFILES + 1 ] # a bit strange - xq echo $NCOREFILES # xq

Re: Help on bash script?

2005-08-12 Thread Benson Wong
I prefer: for COREFILE in `find / -type f -name core -print` do ... done Wouldn't that accomplish the same thing? On 8/12/05, Ian Smith [EMAIL PROTECTED] wrote: On Fri 12 Aug 2005 09:33:54 +0800 Xu Qiang [EMAIL PROTECTED] wrote: find / -type f -name core -print | while

Re: Help on bash script?

2005-08-12 Thread Giorgos Keramidas
On 2005-08-12 13:38, Benson Wong [EMAIL PROTECTED] wrote: I prefer: for COREFILE in `find / -type f -name core -print` do ... done Wouldn't that accomplish the same thing? More or less. Less, when the filenames are too many. See questions posted on this very same list about ``too many

Help on bash script?

2005-08-11 Thread Xu Qiang
Hi, all: I don't know if this is the right list to ask this question. But since I didn't find a bash script mail list and you guys are always so helpful, then... Here are an excerpt of a bash script: --- #!/bin/bash # saveLogs.sh - Bourne

Re: Help on bash script?

2005-08-11 Thread dpk
On Fri, 12 Aug 2005, Xu Qiang wrote: Hi, all: I don't know if this is the right list to ask this question. But since I didn't find a bash script mail list and you guys are always so helpful, then... Here are an excerpt of a bash script

RE: Help on bash script?

2005-08-11 Thread Xu Qiang
dpk wrote: On Fri, 12 Aug 2005, Xu Qiang wrote: As soon as you used the pipe, to the while, you entered a sub-shell. There's no way (that I'm aware of anyways) to get the sub-shell's variables sent back up to the parent. Thanks for your detailed analysis and a solution. Yes, I didn't notice

Re: Help on bash script?

2005-08-11 Thread Giorgos Keramidas
On 2005-08-12 10:16, Xu Qiang [EMAIL PROTECTED] wrote: Btw, can we export a value in the sub-shell back to the parent? Only through `backquote subtitution', as the child process cannot affect the environment of the parent process. value=`shell command` value=$(shell command)

RE: Help on bash script?

2005-08-11 Thread Xu Qiang
Giorgos Keramidas wrote: On 2005-08-12 10:16, Xu Qiang [EMAIL PROTECTED] wrote: Btw, can we export a value in the sub-shell back to the parent? Only through `backquote subtitution', as the child process cannot affect the environment of the parent process. value=`shell command`

RE: Help on bash script?

2005-08-11 Thread Xu Qiang
dpk wrote: On Fri, 12 Aug 2005, Xu Qiang wrote: 1. The way of incrementing the variable NCOREFILES. Why does it use the formula of NCOREFILES=$[ $NCOREFILES + 1 ], and not the direct way of NCOREFILES=$NCOREFILES+1? If that was done, NCOREFILES would end up looking like: +1+1+1+1+1+1+1

RE: Help on bash script?

2005-08-11 Thread Xu Qiang
This is my test script: - #!/bin/bash var=0 var=$[3] vari=0 ++vari echo $var echo $vari - The result is: ./test.sh: ++vari: command not found 3 0 So the manual of bash is incorrect? Regards, Xu Qiang

RE: Help on bash script?

2005-08-11 Thread dpk
On Fri, 12 Aug 2005, Xu Qiang wrote: This is my test script: - #!/bin/bash var=0 var=$[3] vari=0 ++vari echo $var echo $vari - The result is: ./test.sh: ++vari: command not found 3 0 So the manual of bash is incorrect? Regards, Xu

RE: Help on bash script?

2005-08-11 Thread Xu Qiang
dpk wrote: It will work with either 'let' or within an 'arithmetic expansion': $[++var] let ++var By the way, there is another syntax, from the man page, that seems to operate identically: $((++var)) and $((var+1)) With let ++var, the result is still 0, it isn't incremented. With

bash script

2005-08-05 Thread virtual
My knowledge in bash scripting is about medium not very advanced and all so I am not attempting to make a connection limiter but what I want to make is a script that checks the irc connections off a certain user and takes some actions, mostly of this I know how to do but I got stuck at this : I

Simple bash script to grep files for bad keywords

2005-03-23 Thread Brian John
Hello, I am trying to write a simple bash script that will grep all files in a directory (except ones that start with 00) for certain bad keywords. Here is what I have so far: #!/bin/bash # This is a simple script to check all sql scripts for bad keywords BAD_KEYWORDS='spool echo timing commit

Re: Simple bash script to grep files for bad keywords

2005-03-23 Thread Giorgos Keramidas
On 2005-03-23 12:29, Brian John [EMAIL PROTECTED] wrote: Hello, I am trying to write a simple bash script that will grep all files in a directory (except ones that start with 00) for certain bad keywords. Here is what I have so far: #!/bin/bash # This is a simple script to check all sql

Re: Simple bash script to grep files for bad keywords

2005-03-23 Thread Brian John
On 2005-03-23 12:29, Brian John [EMAIL PROTECTED] wrote: Hello, I am trying to write a simple bash script that will grep all files in a directory (except ones that start with 00) for certain bad keywords. Here is what I have so far: #!/bin/bash # This is a simple script to check

Re: Simple bash script to grep files for bad keywords

2005-03-23 Thread Philip M. Gollucci
Brian John wrote: On 2005-03-23 12:29, Brian John [EMAIL PROTECTED] wrote: Hello, I am trying to write a simple bash script that will grep all files in a directory (except ones that start with 00) for certain bad keywords. Here is what I have so far: #!/bin/bash # This is a simple

Bash script programming. Sending commands to a 'screen' session

2005-02-20 Thread Joachim Dagerot
I just accidentily wiped one of my script folders. Really no big deal, I'm not doing multiK scripts. But I had one nice script laying around. It created an additional window in a named screen session and started a bittorrentheadless session within. I do remember that it took me some days to

A little Bash script to help you.

2003-08-14 Thread Matthew Graybosch
On Mon, 2003-08-11 at 17:49, Constantine wrote: Hello! I am writing a script, which involves unzipping some files. I would have to unzip 4 different zip-files from some directory, and I would need to unzip them to the directory, which would have the same name in it as the original

RE: Using bc in bash script

2003-08-14 Thread Charles Howse
On Thu, Aug 14, 2003 at 10:46:45AM -0500, Charles Howse wrote: Hello List, I've migrated from Redhat Linux 9 to FreeBSD 4.8-RELEASE, character mode - no gui. I'm trying to calculate the number of seconds between $start_time and $end_time in a bash script. Start_time=`date

Re: Using bc in bash script

2003-08-14 Thread Richard Tobin
I'm trying to calculate the number of seconds between $start_time and $end_time in a bash script. Bash has built-in integer arithmetic: et=$[End_time - Start_time] -- Richard ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman

RE: Using bc in bash script

2003-08-14 Thread Charles Howse
Charles, This will set bc precision to 5 decimal places: et=`echo scale=5 ; $end_time - $start_time | bc` Ohhh, I was really hoping on that one...but no, it still reports 0 seconds. Maybe there's something in the script itself that's messing this up. Here is the entire script:

Re: Using bc in bash script

2003-08-14 Thread Jez Hancock
between $start_time and $end_time in a bash script. Start_time=`date +%s` # Seconds past midnight at start of script [ do lots of stuff ] End_time=`date +%s` # Seconds past midnight at end of script Then I want to: et=`bc $end_time - $start_time` to get the number of seconds

Re: Using bc in bash script

2003-08-14 Thread Kirk Strauser
At 2003-08-14T16:45:56Z, Charles Howse [EMAIL PROTECTED] writes: I think this whole thing is dependent on the fact that `date +%s` reports integers. As his daughter says, DUUUH! I only saw the $end_time and $start_time variables, and not their origins. I'll go back to lurking now. :) --

Re: Using bc in bash script

2003-08-14 Thread Joshua Oreman
On Thu, Aug 14, 2003 at 12:58:01PM -0500 or thereabouts, Stephen Hilton wrote: On Thu, 14 Aug 2003 18:34:25 +0100 Jez Hancock [EMAIL PROTECTED] wrote: On Thu, Aug 14, 2003 at 12:23:34PM -0500, Stephen Hilton wrote: On Thu, 14 Aug 2003 12:11:55 -0500 Charles Howse [EMAIL PROTECTED]

Re: Using bc in bash script

2003-08-14 Thread Stephen Hilton
On Thu, 14 Aug 2003 12:11:55 -0500 Charles Howse [EMAIL PROTECTED] wrote: Charles, This will set bc precision to 5 decimal places: et=`echo scale=5 ; $end_time - $start_time | bc` Ohhh, I was really hoping on that one...but no, it still reports 0 seconds. Sorry I jumped the gun

Re: Using bc in bash script

2003-08-14 Thread Kirk Strauser
At 2003-08-14T16:08:21Z, Charles Howse [EMAIL PROTECTED] writes: Can I refine it to give me something like: .784 seconds? Use bc -l instead of bc. That should do it. -- Kirk Strauser pgp0.pgp Description: PGP signature

RE: Using bc in bash script

2003-08-14 Thread Charles Howse
The precision is in hundredths of a second as I understand it from playing with time(!): #!/bin/sh time_file=tmp.time time=time -a -o $time_file $time cat /var/log/messages /dev/null 21 $time cat /var/log/maillog /dev/null 21 awk '{sum+=$1}END{print sum}' $time_file rm

Re: Using bc in bash script

2003-08-14 Thread Jez Hancock
On Thu, Aug 14, 2003 at 10:46:45AM -0500, Charles Howse wrote: Hello List, I've migrated from Redhat Linux 9 to FreeBSD 4.8-RELEASE, character mode - no gui. I'm trying to calculate the number of seconds between $start_time and $end_time in a bash script. Start_time=`date +%s

Using bc in bash script

2003-08-14 Thread Charles Howse
Hello List, I've migrated from Redhat Linux 9 to FreeBSD 4.8-RELEASE, character mode - no gui. I'm trying to calculate the number of seconds between $start_time and $end_time in a bash script. Start_time=`date +%s` # Seconds past midnight at start of script [ do lots of stuff ] End_time=`date

  1   2   >