Re: advanced scripting problems - or wrong approach?

2024-06-03 Thread David Christensen
On 6/2/24 21:35, DdB wrote: Am 02.06.2024 um 02:41 schrieb DdB: Will share my findings, once i made more progress... Here is what i've got before utilizing it: datakanja@PBuster-NFox:/mnt/tmp$ cat test #!/bin/bash -e # testing usefulness of coprocess to control host and backup machine from

Re: advanced scripting problems - or wrong approach?

2024-06-03 Thread Jonathan Dowland
On Sat Jun 1, 2024 at 8:20 AM BST, DdB wrote: > for years have i been using a self-made backup script, that did mount a > drive via USB, performed all kinds of plausibility checks, before > actually backing up incrementally. Finally verifying success and logging > the activities while kicking the I

Re: advanced scripting problems - or wrong approach?

2024-06-02 Thread DdB
Am 02.06.2024 um 02:41 schrieb DdB: > Will share my findings, once i made more progress... Here is what i've got before utilizing it: > datakanja@PBuster-NFox:/mnt/tmp$ cat test > #!/bin/bash -e > # testing usefulness of coprocess to control host and backup machine from a > single script. > #

Re: advanced scripting problems - or wrong approach?

2024-06-01 Thread DdB
Am 01.06.2024 um 16:01 schrieb Greg Wooledge: >> i get the output from ls, but then the thing is hanging indefinitely, >> apparently not reaching the exit line. :( > Your first while loop never terminates. "while read ..." continues > running until read returns a nonzero exit status, either due to

Re: advanced scripting problems - or wrong approach?

2024-06-01 Thread David Christensen
On 6/1/24 00:20, DdB wrote: Hello, for years have i been using a self-made backup script, that did mount a drive via USB, performed all kinds of plausibility checks, before actually backing up incrementally. Finally verifying success and logging the activities while kicking the ISB drive out. S

Re: advanced scripting problems - or wrong approach?

2024-06-01 Thread Greg Wooledge
On Sat, Jun 01, 2024 at 09:20:59AM +0200, DdB wrote: > > #!/bin/bash -e > > > > coproc { bash; } > > exec 5<&${COPROC[0]} 6>&${COPROC[1]} > > fd=5 > > > > echo "ls" >&6 > > while IFS= read -ru $fd line > > do > > printf '%s\n' "$line" > > done > > > > printf "%s\n" "sleep 3;exit" >&6 > > whi

Re: advanced scripting problems - or wrong approach?

2024-06-01 Thread tomas
On Sat, Jun 01, 2024 at 10:53:45AM +0200, DdB wrote: > Am 01.06.2024 um 09:20 schrieb DdB: > > Hello, > > > I get it: you wouldnt trust my scripts. That wasn't the point. I'm just not in the situation to debug it at the moment. > Thats fine with me. But my > experience is quite different: Softwa

Re: advanced scripting problems - or wrong approach?

2024-06-01 Thread DdB
Am 01.06.2024 um 09:20 schrieb DdB: > Hello, > I get it: you wouldnt trust my scripts. Thats fine with me. But my experience is quite different: Software, i prefer using is such, that i keep control. And because backup means different things to different people, i did not bother to explain, what i

Re: advanced scripting problems - or wrong approach?

2024-06-01 Thread tomas
On Sat, Jun 01, 2024 at 08:20:08AM +, Michael Kjörling wrote: > On 1 Jun 2024 10:11 +0200, from to...@tuxteam.de: > >> for years have i been using a self-made backup script [...] > > > > I won't get into that -- I can't even fathom why you'd need coproc > > for a backup script. I tend to keep

Re: advanced scripting problems - or wrong approach?

2024-06-01 Thread Michael Kjörling
On 1 Jun 2024 10:11 +0200, from to...@tuxteam.de: >> for years have i been using a self-made backup script [...] > > I won't get into that -- I can't even fathom why you'd need coproc > for a backup script. I tend to keep things simple -- they tend to > thank me in failing less often and in more u

Re: advanced scripting problems - or wrong approach?

2024-06-01 Thread tomas
On Sat, Jun 01, 2024 at 09:20:59AM +0200, DdB wrote: > Hello, > > for years have i been using a self-made backup script [...] I won't get into that -- I can't even fathom why you'd need coproc for a backup script. I tend to keep things simple -- they tend to thank me in failing less often and in

advanced scripting problems - or wrong approach?

2024-06-01 Thread DdB
Hello, for years have i been using a self-made backup script, that did mount a drive via USB, performed all kinds of plausibility checks, before actually backing up incrementally. Finally verifying success and logging the activities while kicking the ISB drive out. Since a few months, i do have a

Re: interface/network scripting - how to?

2022-02-06 Thread David Wright
On Fri 04 Feb 2022 at 19:14:45 (+0100), Kamil Jońca wrote: > > Current situation: > debian laptop with interfaces defined in /etc/network/interfaces > + resolvconf package and bunch of scripts wchich configures network > (routes and name resolving) according to interfaces/vpn up down. > For exampl

Re: interface/network scripting - how to?

2022-02-05 Thread Kamil Jońca
Anssi Saari writes: > Kamil Jońca writes: > >> 2. name resolving is properly configured: >> ie. home1.tld DNS queries are passed to home1 network >> work1.tld DNS queries are passed to work1 network (via openvpn tunnel) >> work2.tld DNS queries are passed to work2 network (via ipse

Re: interface/network scripting - how to?

2022-02-05 Thread Anssi Saari
Kamil Jońca writes: > 2. name resolving is properly configured: > ie. home1.tld DNS queries are passed to home1 network > work1.tld DNS queries are passed to work1 network (via openvpn tunnel) > work2.tld DNS queries are passed to work2 network (via ipsec tunnel) So how have you se

Re: interface/network scripting - how to?

2022-02-04 Thread Kamil Jońca
john doe writes: [..] > >> 2. How these things can be achieved with systemd-networkd? I read the >> manuals, but I was not able to find working examples and I am not sure >> where can I start. >> > > The Systemd mailing lists! Thanks. Will try. KJ -- http://stopstopnop.pl/stop_stopnop.pl_o_nas

Re: interface/network scripting - how to?

2022-02-04 Thread john doe
On 2/4/2022 7:14 PM, Kamil Jońca wrote: Current situation: debian laptop with interfaces defined in /etc/network/interfaces + resolvconf package and bunch of scripts wchich configures network (routes and name resolving) according to interfaces/vpn up down. For example 1. I am connected to home

Re: interface/network scripting - how to?

2022-02-04 Thread tomas
On Fri, Feb 04, 2022 at 01:33:54PM -0500, Greg Wooledge wrote: > On Fri, Feb 04, 2022 at 07:14:45PM +0100, Kamil Jońca wrote: > > I am quite happy with my current config but sometimes I can read that > > /etc/network/interfaces is "deprecated" in favor of systemd-networkd or > > netplan. > > Where

Re: interface/network scripting - how to?

2022-02-04 Thread Greg Wooledge
On Fri, Feb 04, 2022 at 07:14:45PM +0100, Kamil Jońca wrote: > I am quite happy with my current config but sometimes I can read that > /etc/network/interfaces is "deprecated" in favor of systemd-networkd or > netplan. Where did you read this? Sounds like Red Hat or XDG or systemd propaganda. > S

interface/network scripting - how to?

2022-02-04 Thread Kamil Jońca
Current situation: debian laptop with interfaces defined in /etc/network/interfaces + resolvconf package and bunch of scripts wchich configures network (routes and name resolving) according to interfaces/vpn up down. For example 1. I am connected to home1 network (connected by wifi, no default

Re: quick scripting 'is /P/Q mounted'

2018-03-14 Thread Mark Fletcher
On Tue, Mar 13, 2018 at 03:56:00PM -0400, The Wanderer wrote: > On 2018-03-13 at 15:39, Joe wrote: > > > On Tue, 13 Mar 2018 14:49:56 +0100 wrote: > > That test can be spoofed, however, by the creation of a directory with > the same name (and/or other characteristics) under the mount point while

Re: quick scripting 'is /P/Q mounted'

2018-03-13 Thread Joe
On Tue, 13 Mar 2018 15:56:00 -0400 The Wanderer wrote: > On 2018-03-13 at 15:39, Joe wrote: > > > On Tue, 13 Mar 2018 14:49:56 +0100 wrote: > > >> On Tue, Mar 13, 2018 at 10:33:43PM +0900, Mark Fletcher wrote: > > >>> Unless I've misunderstood the question, you can tell if > >>> something

Re: quick scripting 'is /P/Q mounted'

2018-03-13 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tue, Mar 13, 2018 at 03:56:00PM -0400, The Wanderer wrote: > On 2018-03-13 at 15:39, Joe wrote: [...] > > I prefer to test for the existence of a known lower directory in > > this case, which tests not only for mounting but for a successful > > re

Re: quick scripting 'is /P/Q mounted'

2018-03-13 Thread The Wanderer
On 2018-03-13 at 15:39, Joe wrote: > On Tue, 13 Mar 2018 14:49:56 +0100 wrote: >> On Tue, Mar 13, 2018 at 10:33:43PM +0900, Mark Fletcher wrote: >>> Unless I've misunderstood the question, you can tell if >>> something is mounted at a mount point by checking if anything is >>> present under the

Re: quick scripting 'is /P/Q mounted'

2018-03-13 Thread Joe
On Tue, 13 Mar 2018 14:49:56 +0100 wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On Tue, Mar 13, 2018 at 10:33:43PM +0900, Mark Fletcher wrote: > > > > > Unless I've misunderstood the question, you can tell if something > > is mounted at a mount point by checking if anything i

Re: quick scripting 'is /P/Q mounted'

2018-03-13 Thread Greg Wooledge
On Tue, Mar 13, 2018 at 07:51:32AM -0700, Mike McClain wrote: > Thank you Richard. > I suspect $(grep /south40/docs/ /proc/mounts) would be faster than But that would be wrong, because it would incorrectly return "true" if you have something mounted at /south40/docs/subdir or /media/south40/docs/

Re: quick scripting 'is /P/Q mounted'

2018-03-13 Thread Mike McClain
Thank you Richard. I suspect $(grep /south40/docs/ /proc/mounts) would be faster than $( mount | grep 'south40/docs'). And I'm sure [ -f /south40/docs/.flag ] would be. Much obliged. Mike On Tue, Mar 13, 2018 at 05:37:07PM +1300, Richard Hector wrote: > On 13/03/18 16:40, Mike McClain wrote: > > I

Re: quick scripting 'is /P/Q mounted'

2018-03-13 Thread Mike McClain
Thank you David. As it happens I have util-linux installed but as with most of Gnu/Linux there are hundreds of programs I've never used and don't know what do. Appreciate the heads-up. Mike On Tue, Mar 13, 2018 at 08:49:58PM +1100, David wrote: > On 13 March 2018 at 14:40, Mike McClain wrote: > >

Re: quick scripting 'is /P/Q mounted'

2018-03-13 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tue, Mar 13, 2018 at 10:33:43PM +0900, Mark Fletcher wrote: > On Tue, Mar 13, 2018 at 08:49:58PM +1100, David wrote: > > On 13 March 2018 at 14:40, Mike McClain wrote: > > > > > > If my other computer is South40 and I want to mount South40's /docs

Re: quick scripting 'is /P/Q mounted'

2018-03-13 Thread Mark Fletcher
On Tue, Mar 13, 2018 at 08:49:58PM +1100, David wrote: > On 13 March 2018 at 14:40, Mike McClain wrote: > > > > If my other computer is South40 and I want to mount South40's /docs > > on my /south40/docs/ directory I can do that. As one script calls > > another I want to know if I need to mount So

Re: quick scripting 'is /P/Q mounted'

2018-03-13 Thread David
On 13 March 2018 at 14:40, Mike McClain wrote: > > If my other computer is South40 and I want to mount South40's /docs > on my /south40/docs/ directory I can do that. As one script calls > another I want to know if I need to mount South40 without > $( mount | grep 'south40/docs'). > > Suggestions?

Re: quick scripting 'is /P/Q mounted'

2018-03-12 Thread Richard Hector
On 13/03/18 16:40, Mike McClain wrote: > A while back, Pierre Gaston posted this little tidbit to quickly > determine if my network is up: > [ "$( > Now I wonder if there is a similar file in /sys that would tell if > anything is mounted on a particular directory. I've browsed /sys but > not f

quick scripting 'is /P/Q mounted'

2018-03-12 Thread Mike McClain
A while back, Pierre Gaston posted this little tidbit to quickly determine if my network is up: [ "$(

scripting soundcards in debian?

2015-11-25 Thread Karen Lewellen
Hi everyone, i suspect that Larry's question might not have been articulated properly, so trying again. he has four soundcards, and runs Debian from the console. What he desires, if even technically possible, is a way to insure an application will skip to the next unused soundcard, or perhaps

Re: Bash Scripting Question

2013-11-07 Thread Chris Davies
Jonathan Dowland wrote: > On Sun, Nov 03, 2013 at 09:58:58PM +0100, Erwan David wrote: >> Maybe you'll need something like expect to handle this. > I'd second expect, it's probably the best tool for the job in all > non-trivial cases. The "empty-expect" package, perhaps? Chris -- To UNSUBSCRI

Re: Bash Scripting Question

2013-11-05 Thread Zenaan Harkness
On 11/4/13, Thomas H. George wrote: > The script I am trying to write executes a program that requires a > keyboard response. I have experimented with redirecting STDIN but haven't > found the > correct way to make the response. To read a value (perhaps half your "problem"): apt-cache show ... z

Re: Bash Scripting Question

2013-11-04 Thread Karl E. Jorgensen
trying to do "crazy" stuff, e.g. like removing essential packages. Even the simpler questions are there to give you a chance not to shoot yourself in the foot: If you script the answers to them, your (metaphorical) foot is in danger... > I'm sure this must be elementary but I have

Re: Bash Scripting Question

2013-11-04 Thread Jonathan Dowland
The tool 'yes' can be used to write an infinite stream of strings (the default being 'y') to standard output, so if your program needed only a sequence of a fixed string such as 'y', you could do > yes | your-program or > yes "some-other-string" | your-program But if your program is not readin

Re: Bash Scripting Question

2013-11-03 Thread Erwan David
e > response from apt-get install for the letter y and fed this back to > install . In my case I must respond with a word in answer to the > programs question. > > I'm sure this must be elementary but I have read large sections of > BASH GUIDE FOR BEGINNERS and AVANCE

Re: Bash Scripting Question

2013-11-03 Thread Cousin Stanley
> The script I am trying to write executes a program > that requires a keyboard response. > A varaible can be set to a keyboard response using a read prompt read -e -p "What do you need ?" xVariable echo $xVariable -- Stanley C. Kitching Human Being Phoenix, Arizon

Bash Scripting Question

2013-11-03 Thread Thomas H. George
ck to install . In my case I must respond with a word in answer to the programs question. I'm sure this must be elementary but I have read large sections of BASH GUIDE FOR BEGINNERS and AVANCED BASH-SCRIPTING GUIDE without finding a solution. I would appreciate a little help or ad

Re: scripting inherited commands user rights

2013-02-07 Thread Muhammad Yousuf Khan
Thanks Alex and linux-Fan, this worked for me :) -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/CAGWVfMnbgxHar3OzNrE=piqDCfbCTZr3=jhl43regwepnoe...@mail.gmail.com

Re: scripting inherited commands user rights

2013-02-07 Thread Alex Mestiashvili
On 02/07/2013 03:54 PM, Muhammad Yousuf Khan wrote: > Thanks for the hint i have been going through couple of howtos but it > is still not working same error i put this line at the bottom of the > VISUDO still no luck > > %ykhan ALL = NOPASSWD: /usr/bin/myscript > btw %ykhan -means members of g

Re: scripting inherited commands user rights

2013-02-07 Thread Linux-Fan
On 02/07/2013 03:54 PM, Muhammad Yousuf Khan wrote: > Thanks for the hint i have been going through couple of howtos but it > is still not working same error i put this line at the bottom of the > VISUDO still no luck > > %ykhan ALL = NOPASSWD: /usr/bin/myscript > > when i run the script with use

Re: scripting inherited commands user rights

2013-02-07 Thread Alex Mestiashvili
On 02/07/2013 03:54 PM, Muhammad Yousuf Khan wrote: > Thanks for the hint i have been going through couple of howtos but it > is still not working same error i put this line at the bottom of the > VISUDO still no luck > > %ykhan ALL = NOPASSWD: /usr/bin/myscript > > when i run the script with user

Re: scripting inherited commands user rights

2013-02-07 Thread Muhammad Yousuf Khan
Thanks for the hint i have been going through couple of howtos but it is still not working same error i put this line at the bottom of the VISUDO still no luck %ykhan ALL = NOPASSWD: /usr/bin/myscript when i run the script with user ykhan still give me the same error. would you please be kind en

Re: scripting inherited commands user rights

2013-02-07 Thread Alex Mestiashvili
On 02/07/2013 02:10 PM, Muhammad Yousuf Khan wrote: > i have got a /data folder where no one has rights accept user "root". > and for some reasons or reducing my dependency i have created a script > which include > "mkdir" command > > like this > > mkdir /data/example > > the script own by the u

scripting inherited commands user rights

2013-02-07 Thread Muhammad Yousuf Khan
i have got a /data folder where no one has rights accept user "root". and for some reasons or reducing my dependency i have created a script which include "mkdir" command like this mkdir /data/example the script own by the user and have got rights 700 on the script file so that only that specifi

Re: OT: A question about bash scripting

2012-10-30 Thread Ralf Mardorf
On Tue, 30 Oct 2012 08:58:31 +0100, Chris Davies wrote: done=$(date +%s) month=$(date --date @$done +%B) mon=$(date --date @$done +%b) d_y_t=$(date --date @$done +'/%d/%Y %T') I agree, good idea. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subj

Re: OT: A question about bash scripting

2012-10-30 Thread Chris Davies
Ralf Mardorf wrote: > month=$(date +%B) > mon=$(date +%b) > d_y_t=$(date '+/%d/%Y %T') > done=$(date +%s) You've got a horrible race condition in there just waiting to bite you. Try this instead: done=$(date +%s) month=$(date --date @$done +%B) mon=$(date --date @$done +%b) d_y_t

[sloved] OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
On Mon, 2012-10-29 at 18:52 -0400, Neal Murphy wrote: > What's the '+100' supposed to do? ### Killall and Restore session started=$(date +%s) SECONDS=0 sleep 2 ### Time month=$(date +%B) mon=$(date +%b) d_y_t=$(date '+/%d/%Y %T') done=$(date +%s) done_2=$SECONDS ((seconds=(done-start

Re: OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
On Mon, 2012-10-29 at 21:31 +, Dom wrote: > Would this do what you are after? > > ### Killall and Restore session > started=$(date +%s) > sleep 2 > > ### Time > month=$(date +%B) > mon=$(date +%b) > d_y_t=$(date '+/%d/%Y %T') > done=$(date +%s) > echo > printf "Attended time to restore sessio

Re: OT: A question about bash scripting

2012-10-29 Thread Neal Murphy
On Monday, October 29, 2012 04:31:03 PM Ralf Mardorf wrote: > FOR YOUR EXAMPLE, IIUC IT SHOULD BE? ... > > ### Killall and Restore session > started=$(date +%s) > sleep 2 > > ### Time > month=$(date +%B) > mon=$(date +%b) > d_y_t=$(date '+/%d/%Y %T') > done=$(date +%s) > #((seconds=(don

Re: OT: A question about bash scripting

2012-10-29 Thread Dom
On 29/10/12 20:31, Ralf Mardorf wrote: (trimmed) I want ((seconds=(done-started)-(((done-started)/60)*60)+100)) min_sec=$(((done-started)/60))":"${seconds: -2} in one line, instead of two lines. I don't understand your reply. Even if I would add ${min_sec: 2} to each "echo" command (ther

Re: OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
> ... WHILE I WONT THIS 2 lines, AS ONE LINE, INCLUDING THE FORMATTING: Oops, an evil typo ;), it should be "... while I want". The capital letters aren't for shouting, just to distinguish the mail's text from the script. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a

Re: OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
On Mon, 2012-10-29 at 15:59 -0400, Neal Murphy wrote: > On Monday, October 29, 2012 03:26:20 PM Ralf Mardorf wrote: > > > On Mon, 2012-10-29 at 15:00 -0400, Wolf Halton wrote: > > > > On Mon, Oct 29, 2012 at 6:57 AM, Ralf Mardorf > > > > > > > > wrote: > > > > > Hi :) > > > > > > > > > >

Re: OT: A question about bash scripting

2012-10-29 Thread Neal Murphy
On Monday, October 29, 2012 03:26:20 PM Ralf Mardorf wrote: > On Mon, 2012-10-29 at 15:00 -0400, Wolf Halton wrote: > > On Mon, Oct 29, 2012 at 6:57 AM, Ralf Mardorf > > > > wrote: > > > Hi :) > > > > > > how can I get rid of the variable "seconds"? > > > > > > ((seconds=(done-started)-(((done-

Re: OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
On Mon, 2012-10-29 at 15:00 -0400, Wolf Halton wrote: > On Mon, Oct 29, 2012 at 6:57 AM, Ralf Mardorf > wrote: > > Hi :) > > > > how can I get rid of the variable "seconds"? > > > > ((seconds=(done-started)-(((done-started)/60)*60)+100)) > > min_sec=$(((done-started)/60))":"${seconds: -2} > >

Re: Crontab, Scripting and Syslog (solved)

2012-07-04 Thread Titanus Eramius
On Mon, 02 Jul 2012 15:07:46 +0100 Chris Davies wrote: > Titanus Eramius wrote: > > * 04 * * * /home/titanus/scripts/web-log >> /dev/null 2>&1 > > > The line runs every morning at 4, and AFAIK, the /dev/-part should > > redirect all but errors to null. > > No. > > 1. This runs every minute wh

Re: Crontab, Scripting and Syslog (solved)

2012-07-04 Thread Titanus Eramius
On Mon, 2 Jul 2012 15:47:35 +0200 Titanus Eramius wrote: > snip > > > # min hr dom mon dow command > > > * 04 * * * /home/titanus/scripts/web-log >> /dev/null 2>&1 > > > > That is, every minute during hour 4, on every day of every month > > (that being every day of the week), the comma

Re: Crontab, Scripting and Syslog

2012-07-02 Thread Chris Davies
Titanus Eramius wrote: > * 04 * * * /home/titanus/scripts/web-log >> /dev/null 2>&1 > The line runs every morning at 4, and AFAIK, the /dev/-part should > redirect all but errors to null. No. 1. This runs every minute while the hour is 4. If you want the script to run only a 4am, you need to sp

Re: Crontab, Scripting and Syslog

2012-07-02 Thread Titanus Eramius
snip > # min hr dom mon dow command > > * 04 * * * /home/titanus/scripts/web-log >> /dev/null 2>&1 > > That is, every minute during hour 4, on every day of every month (that > being every day of the week), the command is run. > > Presumably, webalizer writes its output to the same place

Re: Crontab, Scripting and Syslog

2012-07-02 Thread Darac Marjal
On Mon, Jul 02, 2012 at 02:51:06PM +0200, Titanus Eramius wrote: > Hi folks > On my webserver I've recently added a log-sorting and presentation > program by the name of Webalizer. To make it run, I've put this line in > the crontab (everything runs as a normal user): > > * 04 * * * /home/titanus/

Crontab, Scripting and Syslog

2012-07-02 Thread Titanus Eramius
Hi folks On my webserver I've recently added a log-sorting and presentation program by the name of Webalizer. To make it run, I've put this line in the crontab (everything runs as a normal user): * 04 * * * /home/titanus/scripts/web-log >> /dev/null 2>&1 The line runs every morning at 4, and AFAI

Re: Scripting question

2012-04-17 Thread Daniel Landau
On Tue, Apr 17, 2012 at 4:52 PM, Eduardo M KALINOWSKI wrote: > On Ter, 17 Abr 2012, Chris wrote: >> I would like have the Smtp: replaced with To:  leaving all that follows in >> each line untouched and piped into a new file. > > man sed > Read that too, but try also searching online for "sed tuto

Re: Scripting question

2012-04-17 Thread emmanuel segura
perl -e 'while(<>){chomp; s/root/Root/g; print "$_\n"; }' /etc/passwd Il giorno 17 aprile 2012 15:52, Eduardo M KALINOWSKI < edua...@kalinowski.com.br> ha scritto: > On Ter, 17 Abr 2012, Chris wrote: > >> Firstly I petty much suck at scripting so

Re: Scripting question

2012-04-17 Thread Eduardo M KALINOWSKI
On Ter, 17 Abr 2012, Chris wrote: Firstly I petty much suck at scripting so I need help. I have a file where each line begins with Smtp: I would like have the Smtp: replaced with To: leaving all that follows in each line untouched and piped into a new file. man sed -- The majority of

Scripting question

2012-04-17 Thread Chris
All Firstly I petty much suck at scripting so I need help. I have a file where each line begins with Smtp: I would like have the Smtp: replaced with To: leaving all that follows in each line untouched and piped into a new file. Thanks!! Chris

Re: scripting question: to parse data with varname=value pattern the easiest way?

2010-11-02 Thread Zhang Weiwu, Beijing
On 11/02/2010 05:04 AM, Karl Vogel wrote: >On the other hand, if someone sneaks something like >result_04: dc="3" rm /something/valuable Thank you! very informative, and, kinda fun to read. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscr

Re: scripting question: to parse data with varname=value pattern the easiest way?

2010-11-01 Thread Karl Vogel
>> On Mon, 01 Nov 2010 15:49:01 +0800, >> Zhang Weiwu said: Z> A program output is like this: Z> result_01: a="23" b="288" c="A_string" ac="34" Z> result_02: a="23" b="28" c="A_string_too" dc="3" Z> Z> I am writing a script to output values of b if b is in the result set. If your

scripting question: to parse data with varname=value pattern the easiest way?

2010-11-01 Thread Zhang Weiwu
Hello. A program output is like this: result_01: a="23" b="288" c="A_string" ac="34" result_02: a="23" b="28" c="A_string_too" dc="3" I am writing a script to output values of b if b is in the result set. It would be rather easy to match value of with regular expression: /b="([^"]*)"/ #

Re: Scripting gnome-panels

2010-05-20 Thread Mickey Fox
> Just some hints to you. You man configure one and only panel. Then run the command: gconftool -R /apps/panel > one_panel Then add another panel and configure it as you will. Then run gconftool again: gconftool -R /apps/panel > two_panels Maybe all the differences are that between file &q

Scripting gnome-panels

2010-05-18 Thread Eric Persson
I have a small bashscript which prepares a dual-monitor setup for my laptop, since i'm moving in and out of the office and meetings, I tend to attach and disconnect the monitor a few times a day. That works fine with xrandr, but the issue is that I would like some gnome panels to move, and add

Re: bash scripting question

2010-03-29 Thread Karl Vogel
Here's something I modified as part of a benchmark script called "fdtree". -- Karl Vogel I don't speak for the USAF or my company Dijkstra probably hates me. --Linus Torvalds, in kernel/sched.c #!/bin/bash # How to use xdate/xtime/persec: # # START=$(date "+%s")

Re: bash scripting question

2010-03-29 Thread Ron Johnson
On 2010-03-29 16:35, Mike McClain wrote: [snip] Thanks a lot. Though my error was pointed out as a typo and corrected a while back your solution using " date '+%s' " is much more elegant than what I had done. If you want more (possibly too much) precision: $ date +'%s.%N' -- "History does not

Re: bash scripting question

2010-03-29 Thread Mike McClain
Hi Josep, On Mon, Mar 29, 2010 at 02:28:20PM +0200, Josep M. wrote: > > I found these somewhere time ago. check if is what You need: > Thanks a lot. Though my error was pointed out as a typo and corrected a while back your solution using " date '+%s' " is much more elegant than what I had don

Re: bash scripting question

2010-03-29 Thread Josep M.
Hello. I found these somewhere time ago. check if is what You need: function timer() { if [[ $# -eq 0 ]]; then echo $(date '+%s') else local stime=$1 etime=$(date '+%s') if [[ -z "$stime" ]]; then stime=$etime; fi dt=$((etime - stime)

Re: bash scripting question

2010-03-19 Thread Chris Jackson
Paul E Condon wrote: Try: bgn=$(date +%s) sleep 7 end=$(date +%s) echo "elapsed seconds = " $(( end - bgn )) You might also want to experiment with: ps h -o etime $$ as long as you're happy with it only running under gnu. Prints the elapsed time for the shell. -- Chris Jackson Shadowcat

Re: bash scripting question

2010-03-19 Thread Paul E Condon
On 20100319_101928, Mike McClain wrote: > I've written a function to print elapsed time similar to /usr/bin/time > but can be called at the beginning and end of a script from within > the script. Occasionally I get an error: '8-08: value too great for base' > It's caused by the difference in these

Re: bash scripting question

2010-03-19 Thread Mike McClain
On Fri, Mar 19, 2010 at 06:45:15PM +0100, Sven Joachim wrote: > On 2010-03-19 18:19 +0100, Mike McClain wrote: > > > I've written a function to print elapsed time similar to /usr/bin/time > > but can be called at the beginning and end of a script from within > > the script. Occasionally I get an e

Re: bash scripting question

2010-03-19 Thread Mike McClain
On Fri, Mar 19, 2010 at 10:19:28AM -0700, Mike McClain wrote: typo right herevv > now='09:07:16'; startHr=${now%%:*}; startHR=${startHr#*0}; echo $startHr; Apologies for troubling all. Mike (with egg on face) -- Satisfied user of Linux since 1997. O< ascii ribbon c

Re: bash scripting question

2010-03-19 Thread Wayne
Mike McClain wrote: I've written a function to print elapsed time similar to /usr/bin/time but can be called at the beginning and end of a script from within the script. Occasionally I get an error: '8-08: value too great for base' It's caused by the difference in these 2 command strings but I ca

Re: bash scripting question

2010-03-19 Thread Chris Jackson
Mike McClain wrote: I've written a function to print elapsed time similar to /usr/bin/time but can be called at the beginning and end of a script from within the script. Occasionally I get an error: '8-08: value too great for base' It's caused by the difference in these 2 command strings but I c

Re: bash scripting question

2010-03-19 Thread S Scharf
On Fri, Mar 19, 2010 at 1:19 PM, Mike McClain wrote: > I've written a function to print elapsed time similar to /usr/bin/time > but can be called at the beginning and end of a script from within > the script. Occasionally I get an error: '8-08: value too great for base' > It's caused by the diffe

Re: bash scripting question

2010-03-19 Thread Sven Joachim
On 2010-03-19 18:19 +0100, Mike McClain wrote: > I've written a function to print elapsed time similar to /usr/bin/time > but can be called at the beginning and end of a script from within > the script. Occasionally I get an error: '8-08: value too great for base' > It's caused by the difference i

bash scripting question

2010-03-19 Thread Mike McClain
I've written a function to print elapsed time similar to /usr/bin/time but can be called at the beginning and end of a script from within the script. Occasionally I get an error: '8-08: value too great for base' It's caused by the difference in these 2 command strings but I can't for the life of m

Re: ssh-agent, keychain, xsession bash_profile scripting

2010-01-15 Thread Boyd Stephen Smith Jr.
On Friday 15 January 2010 14:33:50 T o n g wrote: > On Fri, 15 Jan 2010 11:31:08 -0600, Boyd Stephen Smith Jr. wrote: > > I use this for starting the daemons or connecting to existing daemons by > > setting environment variables in the current shell: eval > > "$(/usr/bin/keychain --eval --quiet --i

Re: ssh-agent, keychain, xsession bash_profile scripting

2010-01-15 Thread Michael Mohn
Am 15.01.2010 um 22:36:53 schrieb Rob Owens: > On Fri, Jan 15, 2010 at 05:11:14PM +, Adam Hardy wrote: >> Jeff D on 15/01/10 17:00, wrote: >>> On Fri, 15 Jan 2010, Adam Hardy wrote: >>> I've been chasing my tail trying to work this one out following different examples off the web, b

Re: ssh-agent, keychain, xsession bash_profile scripting

2010-01-15 Thread Rob Owens
On Fri, Jan 15, 2010 at 05:11:14PM +, Adam Hardy wrote: > Jeff D on 15/01/10 17:00, wrote: >> On Fri, 15 Jan 2010, Adam Hardy wrote: >> >>> I've been chasing my tail trying to work this one out following different >>> examples off the web, but can't sort it out and keep getting the old >>> >>>

Re: ssh-agent, keychain, xsession bash_profile scripting

2010-01-15 Thread T o n g
Thanks Boyd. On Fri, 15 Jan 2010 11:31:08 -0600, Boyd Stephen Smith Jr. wrote: > I use this for starting the daemons or connecting to existing daemons by > setting environment variables in the current shell: eval > "$(/usr/bin/keychain --eval --quiet --inherit any-once --stop others -- > noask --

Re: ssh-agent, keychain, xsession bash_profile scripting

2010-01-15 Thread Florian Ernst
Hello all, On Fri, Jan 15, 2010 at 04:07:44PM +, Adam Hardy wrote: > I've been chasing my tail trying to work this one out following > different examples off the web, but can't sort it out and keep > getting the old > > "Could not open a connection to your authentication agent." > > from ssh

Re: ssh-agent, keychain, xsession bash_profile scripting

2010-01-15 Thread Boyd Stephen Smith Jr.
In <4b5092d0.60...@cyberspaceroad.com>, Adam Hardy wrote: >keychain id_rsa in my .bash_profile doesn't work, I still have to give ssh > my password for the private key when I use ssh. I use this for starting the daemons or connecting to existing daemons by setting environment variables in the cur

Re: ssh-agent, keychain, xsession bash_profile scripting

2010-01-15 Thread Adam Hardy
Jeff D on 15/01/10 17:00, wrote: On Fri, 15 Jan 2010, Adam Hardy wrote: I've been chasing my tail trying to work this one out following different examples off the web, but can't sort it out and keep getting the old "Could not open a connection to your authentication agent." from ssh-add, and

Re: ssh-agent, keychain, xsession bash_profile scripting

2010-01-15 Thread Jeff D
On Fri, 15 Jan 2010, Adam Hardy wrote: > I've been chasing my tail trying to work this one out following different > examples off the web, but can't sort it out and keep getting the old > > "Could not open a connection to your authentication agent." > > from ssh-add, and nothing but inaction from

ssh-agent, keychain, xsession bash_profile scripting

2010-01-15 Thread Adam Hardy
I've been chasing my tail trying to work this one out following different examples off the web, but can't sort it out and keep getting the old "Could not open a connection to your authentication agent." from ssh-add, and nothing but inaction from keychain. I know everything has to run as a chi

Re: scripting question

2009-07-02 Thread Marc Shapiro
Kumar Appaiah wrote: On Wed, Jul 01, 2009 at 09:28:23AM -0500, Kumar Appaiah wrote: for i in *zzz;do mv "$i" $(echo "$i"|sed 's/^...//'); done But I'd recommend one of these: mrename, krename, gprename, renameutils and more (all apt-gettable, of course). Oh, and I think prename (or just renam

Re: scripting question

2009-07-01 Thread gcrimp
On Wed, Jul 01, 2009 at 07:22:33AM -0700, Marc Shapiro wrote: > I am sure that this is an easy question for those people who do any > reasonable amount of scripting. I'm just not one of them. > > How can I rename all of the files ina directory with the new name being > t

Re: scripting question

2009-07-01 Thread Michael Ekstrand
Marc Shapiro writes: > I am sure that this is an easy question for those people who do any > reasonable amount of scripting. I'm just not one of them. > > How can I rename all of the files ina directory with the new name > being the old name stripped of its leftmost three

Re: scripting question

2009-07-01 Thread Teemu Likonen
On 2009-07-01 18:20 (+0300), Teemu Likonen wrote: > find -type f -print0 | xargs -0 sh -c 'for file in "$@"; > do dir=$(dirname -- "$file") && base=$(basename -- "$file") && > (cd "$dir" && echo mv -- "$base" "${base#???}"); done' ignore Let's simplify it a bit: find -type f

Re: scripting question

2009-07-01 Thread Teemu Likonen
On 2009-07-01 07:22 (-0700), Marc Shapiro wrote: > How can I rename all of the files ina directory with the new name > being the old name stripped of its leftmost three characters. If all > of the files are off the format: > > xxxy.zzz > > I want the new names to be of th

  1   2   3   4   5   6   >