Re: Help with script.

2010-05-19 Thread Afflictedd2
t;by ) and write them all to stdout, separated by newlines. > > In pure bash: > > while IFS="$1" read -r -a array; do > printf "%s\n" "${array[$3 - 1]}" > done < "$2" > > In bash+awk: > > awk -F"$1" -v field="$3" '{print $field}' "$2" > > Yes, that's the entire script. Slap a #!/bin/sh at the top and it's done > (we're not even using bash features in the second one; although we do in > the first one). > > > -- View this message in context: http://old.nabble.com/Help-with-script.-tp28598751p28609763.html Sent from the Gnu - Bash mailing list archive at Nabble.com.

Re: Help with script.

2010-05-19 Thread Allodoxaphobia
On Tue, 18 May 2010 10:08:54 -0700 (PDT), Afflictedd2 wrote: > > I'm tryin to build a script > > Any help appreciated. comp.unix.shell

Re: Help with script.

2010-05-19 Thread Greg Wooledge
On Tue, May 18, 2010 at 10:08:54AM -0700, Afflictedd2 wrote: > > I'm tryin to build a script that will extract columns from a comma > sepparated or x delimited file. And do what with them? That matters, a lot. > I get the following error: > > Naix:Bash Naix$ ./extractCol.sh , cutDemo.input 3 >

Help with script.

2010-05-19 Thread Afflictedd2
7; < cutDemo.input awk: '{ awk: ^ invalid char ''' in expression #!/usr/bin/env bash DELIMETER="'$1'" FILE=$2 COLUMNS="'{ print \$$3 }'" echo "awk -F$DELIMETER $COLUMNS < $FILE" awk -F$DELIMETER $COLUMNS <

Re: Help with script - doesn't work properly from cron

2009-07-20 Thread Erik Olof Wahlstrom
at least so that if this were to escape > and be invoked elsewhere it would have limited damage potential. > > cd "$CURRENT_DIR" || exit 1 > rm -f *.sql.bz2 > >> > Is there a better way to clear out last months files before making the >> > current ba

Re: Help with script - doesn't work properly from cron

2009-07-20 Thread Bob Proulx
Greg Wooledge wrote: > Erik Olof Wahlstrom wrote: > > /usr/bin/mysqldump -uroot -pHardAsMySql321 "$DB" | bzip2 > > > "$DB"_`date +%Y-%m-%d_%k.%M`".sql.bz2" > > # Long line, probably broken by your mailer. For clarity, I'd ># write it on two lines explicitily: > >

Re: Help with script - doesn't work properly from cron

2009-07-20 Thread Greg Wooledge
On Fri, Jul 17, 2009 at 02:53:21PM -0700, Erik Olof Wahlstrom wrote: > #!/bin/bash > BACKUP_DIR="/media/disk/AUTOMATED_BACKUPS/DB_DAILY" > > CURRENT_DIR=$BACKUP_DIR/`date +%d` # See how you call date here without an explicit path? That's good. > DATABASES="$(/usr/bin/mysql -uUsername -pPasswo

Re: Help with script - doesn't work properly from cron

2009-07-18 Thread Bernd Eggink
Erik Olof Wahlstrom schrieb: Hello - I am having a problem with a backup script that I have put together - when I run it as root from the terminal, it works as expected (with one caveat); however, when cron runs it, the daily backup folder is created but no files are deposited into that folder...

Help with script - doesn't work properly from cron

2009-07-17 Thread Erik Olof Wahlstrom
lear out last months files before making the current backups? Thanks for any help in advance... -- View this message in context: http://www.nabble.com/Help-with-script---doesn%27t-work-properly-from-cron-tp24542164p24542164.html Sent from the Gnu - Bash mailing list archive at Nabble.com.

Re: Help with script -- FIXED

2007-08-29 Thread t0nedef
-- View this message in context: http://www.nabble.com/Help-with-scripttf4338503.html#a12381846 Sent from the Gnu - Bash mailing list archive at Nabble.com.

Re: Help with script --

2007-08-28 Thread Andreas Schwab
Bernd Eggink <[EMAIL PROTECTED]> writes: > t0nedef schrieb: > >> echo "Please enter a network name" >> read ESSID >> if [ -n $ESSID ] > > You probably meant: > if [ -z $ESSID ] Really you want this: if [ -z "$ESSID" ] Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Pr

Re: Help with script --

2007-08-28 Thread Bernd Eggink
t0nedef schrieb: echo "Please enter a network name" read ESSID if [ -n $ESSID ] You probably meant: if [ -z $ESSID ] then echo "unable to use a blank network name" exit $E_NOESSID fi Regards, Bernd -- Bernd Eggink [EMAIL PROTECTED] http://sudrala.de

Re: Help with script --

2007-08-27 Thread Pierre Gaston
On 8/28/07, t0nedef <[EMAIL PROTECTED]> wrote: > > > WORK_PATH=/etc/wpa_helper # Storage directory DO NOT MODIFY > WORK_FILE=$WORKPATH/$ESSID.conf # Configuration file DO NOT MODIFY > if [ ! -e $WORKPATH ] > if [ ! -e $WORKFILE ] also you use WORK_PATH WORKPATH WORKFILE WORK_FILE

Re: Help with script --

2007-08-27 Thread Pierre Gaston
On 8/28/07, t0nedef <[EMAIL PROTECTED]> wrote: > > Ok, i wrote this script to help with wpa wireless connections, but for some > reason, it errors out. It says that the ESSID is empty. I've double checked > my syntax, and it looks right to me. *yes, i did double check the syntax for > the read comm

Help with script --

2007-08-27 Thread t0nedef
twork={" >> $WORKFILE echo "ssid=\"$ESSID\"" >> $WORKFILE echo "psk=\"$PSK\"" >> $WORKFILE echo "}" >> $WORKFILE fi wpa_assistant -D$DRIVER -i$IFACE -c$WORKFILE & dhclient $IFACE echo "Your wireless is now ready to use!" exit 0 -- View this message in context: http://www.nabble.com/Help-with-scripttf4338503.html#a12358222 Sent from the Gnu - Bash mailing list archive at Nabble.com.