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 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 in /dev/ is a level of Fre

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 > 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...@remot

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 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/ > mount_smbfs //u...@

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 "BAS

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 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 shar

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 ag

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

2010-08-17 Thread Anonymous
Drew Tomlinson 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") > > IFS=$O Old IFS value can be preserved by using `local' keyword or (...) braces,

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 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 Kenny Loggins -

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 http://lists.freebsd.org/mailman/listin

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 It.mp3

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 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 link

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 m

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 wrote: > > Hi guys, > > > > Here's a bash-related question, kind-of. Is there any way to > > automagically run my .csrhc thru a script and wi

Re: bash script question

2009-12-01 Thread Gary Kline
out having to install any > >>>ports. > >>That's a very good advice. Using sh is strongly recommended > >>for maximal portability. Use sh if you're not requiring > >>features that are bash-only. > >> > >> > > > > Hi

Re: bash script question

2009-12-01 Thread Polytropon
On Tue, 1 Dec 2009 13:45:55 -0800, Gary Kline 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

Re: bash script question

2009-12-01 Thread Rolf G Nielsen
t 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 sin

Re: bash script question

2009-12-01 Thread Gary Kline
ty. 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 > >

Re: bash script question

2009-12-01 Thread Polytropon
On Tue, 01 Dec 2009 21:06:34 +0100, Rolf G Nielsen 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?). By using > /bin/sh, yo

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ó To: freebsd-questions@freebsd.org Sent: Tue, December 1, 2009 8:37:04 PM Subject: bash scr

Re: bash script question

2009-12-01 Thread Polytropon
On Tue, 1 Dec 2009 11:48:43 -0800 (PST), Dánielisz László 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 mkdir "f

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 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ó To: freebsd-questions@freebsd.org Sent: Tue, December 1, 2009 8:37:04 PM Subject: bash script question Hello, I

Re: SUID permission on Bash script

2009-08-30 Thread perryh
Matthew Seaman 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 fdescfs(5) is for. Wh

Re: SUID permission on Bash script

2009-08-30 Thread Matthew Seaman
per...@pluto.rain.com wrote: RW 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 ago

Re: SUID permission on Bash script

2009-08-29 Thread perryh
RW 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 ago ... and is descr

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 parameters,

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 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 preve

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 wrote: > > On Fri, 28 Aug 2009 11:54:19 +0300 > > Giorgos Keramidas wrote: > > > >> On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo > >> wrote: > > > >> > As far as i know, using SUID, script must runs with root > >>

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 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 pre

Re: SUID permission on Bash script

2009-08-29 Thread Giorgos Keramidas
On Sat, 29 Aug 2009 00:17:24 -0700, Michael David Crawford 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 addition to the l

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 _a

Re: SUID permission on Bash script

2009-08-29 Thread perryh
Michael David Crawford 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 (with elevated pe

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

Re: SUID permission on Bash script

2009-08-28 Thread Giorgos Keramidas
On Sat, 29 Aug 2009 02:24:31 +0100, RW wrote: >On Fri, 28 Aug 2009 11:54:19 +0300 Giorgos Keramidas > wrote: >>On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo >> wrote: >>> As far as i know, using SUID, script must runs with root >>> permissions... so i shoudnt get "Permission denied", what i

Re: SUID permission on Bash script

2009-08-28 Thread Polytropon
On Fri, 28 Aug 2009 20:10:59 -0600, Tim Judd 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 difference of

Re: SUID permission on Bash script

2009-08-28 Thread Tim Judd
On 8/28/09, RW wrote: > On Fri, 28 Aug 2009 11:54:19 +0300 > Giorgos Keramidas wrote: > >> On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo >> wrote: > >> > As far as i know, using SUID, script must runs with root >> > permissions... so i shoudnt get "Permission denied", what im doing >> > wro

Re: SUID permission on Bash script

2009-08-28 Thread RW
On Fri, 28 Aug 2009 11:54:19 +0300 Giorgos Keramidas wrote: > On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo > wrote: > > As far as i know, using SUID, script must runs with root > > permissions... so i shoudnt get "Permission denied", what im doing > > wrong?? > > No it must not. There a

Re: SUID permission on Bash script

2009-08-28 Thread Polytropon
On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo 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 use bash-specific commands a

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 > > On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo > wrote: > > > > > > Im trying to set up a reaaallly basic scrip to allow one user to > > > shutdown my machine without root permisions, seting up

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 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: > [snip] > > Th

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 that

Re: SUID permission on Bash script

2009-08-28 Thread Giorgos Keramidas
On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo 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 > > $ ./apagar.sh > > Permis

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 shut

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: Problem with bash script

2009-06-16 Thread Karl Vogel
>> On Tuesday, June 16, 2009 08:09:09 -0500 Carmel NY >> 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 h

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

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 cou

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 > wrote: > > > > >I am attempting to write a simple Bash script that will find all the > >'*.pem' files in a directory structure and move t

Re: Problem with bash script

2009-06-16 Thread Paul Schmehl
--On Tuesday, June 16, 2009 08:09:09 -0500 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

Re: Problem with bash script

2009-06-16 Thread Carmel NY
On Tue, 16 Jun 2009 15:56:15 +0200 Bertram Scharpf 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 > > what I am doi

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 importa

Re: Problem with bash script

2009-06-16 Thread Moises Castellanos
Hi Carmel On Wed, Jun 17, 2009 at 8:39 AM, 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. >

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 >

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 d

Re: bash script on FreeBSD

2008-10-08 Thread Paul Schmehl
. 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? You don't really need bash for this. Here's a sample awk s

Re: bash script on FreeBSD

2008-10-08 Thread Giorgos Keramidas
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:

Re: bash script on FreeBSD

2008-10-08 Thread Kalpin Erlangga Silaen
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 Frank Shute
et 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 u

Re: bash script on FreeBSD

2008-10-08 Thread Frank Shute
> 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]*

Re: bash script on FreeBSD

2008-10-08 Thread Artis Caune
hen 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? # echo $line |awk '{ print $1 " has uid " $2 }' -- regards, Artis

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 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 > >

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" TMPSUMM

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

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

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` > >

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 por

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 but

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

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 `

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

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 > > N

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.

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 incorrec

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 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

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 com

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
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 notic

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

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.s

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 wri

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 #

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

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 &

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='sp

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 so

SOLVED - Using bc in Bash script

2003-08-14 Thread Charles Howse
Got it going. Instead of running daily_report from cron, I will now run the following: - #!/usr/local/bin/bash # Time and run the Daily_report \time -ho /root/tmp.time ~/bin/daily_report cat /root/tmp.time | cut -f 2 | cut

RE: Using bc in bash script

2003-08-14 Thread Charles Howse
OK, I've been playing with the time command to get the elapsed time of my daily_report script reported in 2 decimal places. If I do: # \time -ha ~/daily.log ~/bin/daily_report (append output of time to ~/daily.log) I get: Time: /root/daily.log permission denied (time output) If I do: # chmod 666

Re: Using bc in bash script

2003-08-14 Thread Jez Hancock
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]> wrote: > > > > Charles, > > > > > > This will set bc precision to 5 decimal places: > > > > > > et=`echo "scale=5 ; $end_time - $start_time" | bc` > > > > O

RE: Using bc in bash script

2003-08-14 Thread Charles Howse
> > Can I refine it to give me something like: .784 seconds? > > Use "bc -l" instead of bc. That should do it. No, that still gives 0 seconds. I think this whole thing is dependent on the fact that `date +%s` reports integers. I'm still interested in something like .874 seconds, but for the ti

RE: Using bc in bash script

2003-08-14 Thread Alexander Haderer
At 11:45 14.08.2003 -0500, Charles Howse wrote: > > Can I refine it to give me something like: .784 seconds? > > Use "bc -l" instead of bc. That should do it. No, that still gives 0 seconds. I think this whole thing is dependent on the fact that `date +%s` reports integers. I'm still interested i

RE: Using bc in bash script

2003-08-14 Thread Charles Howse
I received this msg a short time ago: Antigen for Exchange found daily_report.sh matching =*.sh file filter. The file is currently Removed. The message, "RE: Using bc in bash script", was sent from Charles Howse and was discovered in IMC Queues\Inbound located at mcglinchey/NewOr

Re: Using bc in bash script

2003-08-14 Thread Alexander Haderer
At 11:35 14.08.2003 -0500, Kirk Strauser wrote: 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. Yes, but not in the context mentioned before: > > > 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_

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 sc

Re: Using bc in bash script

2003-08-14 Thread Stephen Hilton
t; 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 &g

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 2>&1 > > $time cat /var/log/maillog >/dev/null 2>&1 > > awk '{sum+=$1}END{print sum}

Re: Using bc in bash script

2003-08-14 Thread Stephen Hilton
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]> wrote: > > > > > > Charles, > > > > > > > > This will set bc precision to 5 d

  1   2   >