Re: OT: bash question

2014-03-06 Thread Todor Petkov
On 05/03/2014 10:13 PM, Mike Wright wrote: Hi all, I need to extract the name of a parent directory, not the whole path. Combinations of dirname and cut didn't get me anywhere. Given this: (the ... indicates that I don't know the dir depth) /.../mydir/my.file How would I extract this: /...

Re: OT: bash question

2014-03-05 Thread Jon Ingason
2014-03-05 21:13, Mike Wright skrev: > Hi all, > > I need to extract the name of a parent directory, not the whole path. > > Combinations of dirname and cut didn't get me anywhere. > > Given this: (the ... indicates that I don't know the dir depth) > > /.../mydir/my.file > > How would I extra

Re: OT: bash question

2014-03-05 Thread Kevin Martin
On 03/05/2014 02:29 PM, Joe Benson wrote: > dirname /PATH/PATH/PATH/filename.txt | awk -F"/" '{print $NF}' should do > it. > > > On Wed, Mar 5, 2014 at 1:13 PM, Mike Wright > wrote: > > Hi all, > > I need to extract the name of a parent directory

Re: OT: bash question

2014-03-05 Thread Joe Benson
dirname /PATH/PATH/PATH/filename.txt | awk -F"/" '{print $NF}' should do it. On Wed, Mar 5, 2014 at 1:13 PM, Mike Wright wrote: > Hi all, > > I need to extract the name of a parent directory, not the whole path. > > Combinations of dirname and cut didn't get me anywhere. > > Given this: (th

Re: OT: bash question

2014-03-05 Thread CS DBA
On 03/05/2014 01:13 PM, Mike Wright wrote: Hi all, I need to extract the name of a parent directory, not the whole path. Combinations of dirname and cut didn't get me anywhere. Given this: (the ... indicates that I don't know the dir depth) /.../mydir/my.file How would I extract this: /..

OT: bash question

2014-03-05 Thread Mike Wright
Hi all, I need to extract the name of a parent directory, not the whole path. Combinations of dirname and cut didn't get me anywhere. Given this: (the ... indicates that I don't know the dir depth) /.../mydir/my.file How would I extract this: /.../mydir/my.file ^ TIA to all takers

Re: Juvenile BASH question

2013-10-22 Thread Gordon Messmer
On 10/21/2013 05:50 AM, Mark Haney wrote: Now, this has worked perfectly for 3 months now, but the last few days I started getting errors about failed authentication to the databases. Here's where it gets weird. I can su postgres - from a BASH prompt just fine,but when I run the script, it asks

RE: Juvenile BASH question

2013-10-21 Thread Bill Oliver
On Mon, 21 Oct 2013, Mark Haney wrote: I will definitely have to look at that. It has to be something like this since it was working until I had to mess with the setup to allow our devs to monitor the DB and backups from Jenkins. Thanks for the help. Don't forget to check your system pr

RE: Juvenile BASH question

2013-10-21 Thread Mark Haney
> My problem is this, if it works as root from a bash prompt, why /won't/ it > work as root from a bash script? Shoudn't it ask for the password in both > instances? > > > Yeah, you'd think so. When stuff like that happens to me, it's often that the environments are different -- I sometimes

RE: Juvenile BASH question

2013-10-21 Thread Bill Oliver
On Mon, 21 Oct 2013, Mark Haney wrote: My problem is this, if it works as root from a bash prompt, why /won't/ it work as root from a bash script? Shoudn't it ask for the password in both instances? Yeah, you'd think so. When stuff like that happens to me, it's often that the environm

RE: Juvenile BASH question

2013-10-21 Thread Bill Oliver
On Mon, 21 Oct 2013, Mark Haney wrote: Is it asking for root password or postgres password? As I'm running the script as root, it's almost certainly asking for thepostgres user password. Heh. You'd think so. But, I've managed to inadvertently su to some user in a script and then run a

RE: Juvenile BASH question

2013-10-21 Thread Mark Haney
> su postgres - -c > >   > > Now, this has worked perfectly for 3 months now, but the last few days > I started getting errors about failed authentication to the databases.  > Here's where it gets weird.  I can su postgres - from a BASH prompt just > fine,but when I run the script, it asks

RE: Juvenile BASH question

2013-10-21 Thread Mark Haney
Is it asking for root password or postgres password? As I'm running the script as root, it's almost certainly asking for thepostgres user password. -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/lis

Re: Juvenile BASH question

2013-10-21 Thread Bill Oliver
On Mon, 21 Oct 2013, Mark Haney wrote: This may sound like a rather juvenile BASH question, but I'm rather stumped and hope it's something simple to fix.  I hope someone has the answer since I don't really have time (swapping out firewalls and half my network is down) to rese

Re: Juvenile BASH question

2013-10-21 Thread Bill Oliver
On Mon, 21 Oct 2013, Mark Haney wrote: This may sound like a rather juvenile BASH question, but I'm rather stumped and hope it's something simple to fix.  I hope someone has the answer since I don't really have time (swapping out firewalls and half my network is down) to rese

Juvenile BASH question

2013-10-21 Thread Mark Haney
This may sound like a rather juvenile BASH question, but I'm rather stumped and hope it's something simple to fix. I hope someone has the answer since I don't really have time (swapping out firewalls and half my network is down) to research it. I have a BASH script that is pr

Re: bash question

2011-02-01 Thread Bob McGowan
On 02/01/2011 05:23 AM, fedora wrote: > dirname $0 > > suomi > > On 2011-02-01 13:03, Patrick O'Callaghan wrote: >> On Mon, 2011-01-31 at 14:49 -0700, compdoc wrote: Is there a bash command that tells an executing script what *its* path is? >>> >>> echo $PWD >> >> No, that just tells where i

Re: bash question

2011-02-01 Thread fedora
dirname $0 suomi On 2011-02-01 13:03, Patrick O'Callaghan wrote: > On Mon, 2011-01-31 at 14:49 -0700, compdoc wrote: >>> Is there a bash command that tells an executing script what *its* path is? >> >> echo $PWD > > No, that just tells where it was executed from. The OP wants to know > where the

RE: bash question

2011-02-01 Thread Patrick O'Callaghan
On Mon, 2011-01-31 at 14:49 -0700, compdoc wrote: > > Is there a bash command that tells an executing script what *its* path is? > > echo $PWD No, that just tells where it was executed from. The OP wants to know where the script actually lives. poc -- users mailing list users@lists.fedoraproje

RE: bash question

2011-01-31 Thread compdoc
> Is there a bash command that tells an executing script what *its* path is? echo $PWD -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_lis

Re: OT: bash question

2011-01-31 Thread Bruno Wolff III
On Mon, Jan 31, 2011 at 12:55:36 -0800, Mike Wright wrote: > > I'm trying to create a self-contained app in that it is both a data > repository and also the location of its binary (BIN/runme, DATA/) so > that the application could be installed anywhere in user space and still > be able to fi

Re: OT: bash question

2011-01-31 Thread Frantisek Hanzlik
Alan J. Gagne wrote: >> My mistake. I forgot to say that the file was invoked from a link. >> Your proposed solution shows the link's location. I have to discover >> the target of the link. > > echo `ls -la $0` This will point only to first target. "readlink" has switches for recursive resolv.

Re: OT: bash question

2011-01-31 Thread Mike Wright
Frantisek Hanzlik wrote: > Mike Wright wrote: >> Alan J. Gagne wrote: >>> You could try echo $0 from inside you script. >> Thanks Alan. >> >> My mistake. I forgot to say that the file was invoked from a link. >> Your proposed solution shows the link's location. I have to discover >> the target

OT: bash question

2011-01-31 Thread Alan J. Gagne
> My mistake. I forgot to say that the file was invoked from a link. > Your proposed solution shows the link's location. I have to discover > the target of the link. echo `ls -la $0` -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin

Re: OT: bash question

2011-01-31 Thread Frantisek Hanzlik
Mike Wright wrote: > Alan J. Gagne wrote: >> You could try echo $0 from inside you script. > > Thanks Alan. > > My mistake. I forgot to say that the file was invoked from a link. > Your proposed solution shows the link's location. I have to discover > the target of the link. > > Ever onward!

Re: OT: bash question

2011-01-31 Thread Mike Wright
Alan J. Gagne wrote: > You could try echo $0 from inside you script. Thanks Alan. My mistake. I forgot to say that the file was invoked from a link. Your proposed solution shows the link's location. I have to discover the target of the link. Ever onward! -- users mailing list users@lists.fe

Re: OT: bash question

2011-01-31 Thread suvayu ali
On Mon, Jan 31, 2011 at 12:32 PM, Mike Wright wrote: > s there a bash command that tells an executing script what *its* path > is?  Not the path where the user is but where the script is. $ cat ./test.sh #!/bin/bash echo $0 is the script echo `dirname $0` is the script location exit $? HTH --

OT: bash question

2011-01-31 Thread Alan J. Gagne
You could try echo $0 from inside you script. -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

Re: OT: bash question

2011-01-31 Thread Mike Wright
Bruno Wolff III wrote: > On Mon, Jan 31, 2011 at 12:32:24 -0800, > Mike Wright wrote: >> Hi all, >> >> Not sure where to find the answer to this question. Google wasn't >> helpful. The users on this list are a great repository of knowledge so >> I thought to try here. >> >> Is there a bash c

Re: OT: bash question

2011-01-31 Thread Bruno Wolff III
On Mon, Jan 31, 2011 at 12:32:24 -0800, Mike Wright wrote: > Hi all, > > Not sure where to find the answer to this question. Google wasn't > helpful. The users on this list are a great repository of knowledge so > I thought to try here. > > Is there a bash command that tells an executing s

OT: bash question

2011-01-31 Thread Mike Wright
Hi all, Not sure where to find the answer to this question. Google wasn't helpful. The users on this list are a great repository of knowledge so I thought to try here. Is there a bash command that tells an executing script what *its* path is? Not the path where the user is but where the scr

Re: perl/bash question - html link out of text

2010-03-07 Thread Mark Knoop
At 18:07 on 07 Mar 2010, Vadkan Jozsef wrote: > I don't know how to modify the: > > sed -r 's,.*(http://[^ \"$]+).*,\1,' > > command, to not just: > $ echo "test string http://somewhere.uk/ test" | sed -r > 's,.*(http://[^ \"$]+).*,\1,' > http://somewhere.uk/";>http://somewhere.uk/ > > rather ou

perl/bash question - html link out of text

2010-03-07 Thread Vadkan Jozsef
I don't know how to modify the: sed -r 's,.*(http://[^ \"$]+).*,\1,' command, to not just: $ echo "test string http://somewhere.uk/ test" | sed -r 's,.*(http://[^ \"$]+).*,\1,' http://somewhere.uk/";>http://somewhere.uk/ rather output this: test string http://somewhere.uk/";>http://somewhere.uk/

Re: perl or bash question ["convert strings in a txt to html links"]

2010-03-01 Thread Dave Cross
On 27 February 2010 17:12, Vadkan Jozsef wrote: > How can I do that in bash or perl, that I have a txt file, e.g.: > > $cat file.txt > Hi, this is the content of the txt file, that contains links like this: > http://www.somewhere.it/, and it could contain: http://somewhere.com, > etc.. > This is t

Re: perl or bash question ["convert strings in a txt to html links"]

2010-02-27 Thread Roberto Ragusa
Vadkan Jozsef wrote: > Turning: > > http://website.org > http://www.website.org > > to this: > > http://website.org>http://website.org > http://www.website.org>http://www.website.org > sed -e 's_\(\bhttp://\S*\)_\1_g' Not perfect, as some characters should be urlencoded inside the href. --

Re: perl or bash question ["convert strings in a txt to html links"]

2010-02-27 Thread Russell Miller
On Saturday 27 February 2010 09:12:06 Vadkan Jozsef wrote: > How can I do that in bash or perl, that I have a txt file, e.g.: > something like sed -ie s/(.*)/\1/ filename Not sure of the EXACT syntax but that should be close. (apologies if this gets sent twice, I sent the first from the wrong a

perl or bash question ["convert strings in a txt to html links"]

2010-02-27 Thread Vadkan Jozsef
How can I do that in bash or perl, that I have a txt file, e.g.: $cat file.txt Hi, this is the content of the txt file, that contains links like this: http://www.somewhere.it/, and it could contain: http://somewhere.com, etc.. This is the second line, that doesn't contains links.. .. This is the X