Re: alias in bash script issue

2023-03-07 Thread Tom Browder
On Sun, Mar 5, 2023 at 07:20 Nicolas George wrote: ... > Tom Browder (12023-03-05): > > Yes, but please use its new name, Raku. Note new releases come out > monthly > so you shouldn't use the Debian packages since they are way behind. We > have I shouldn't have said "you shouldn't use the Debi

Re: alias in bash script issue

2023-03-06 Thread David Wright
On Sun 05 Mar 2023 at 16:30:10 (-0500), Greg Wooledge wrote: > On Sun, Mar 05, 2023 at 02:37:48PM -0600, David Wright wrote: > > There are many lists of dangerous aliases on the web, but I haven't > > found a list of such aliases that can't be transcribed into functions. > > Here's one document: >

Re: alias in bash script issue

2023-03-06 Thread Yassine Chaouche
Le 3/4/23 à 09:22, Ken Young a écrit : Hello, Hi Ken! 3) the content of bash script $ cat get.sh #!/bin/bash source ~/.bash_profile k get node 4) alias can't work $ ./get.sh ./get.sh: line 5: k: command not found Two options : 1. either use #!/bin/bash -i as your shebang.

Re: alias in bash script issue

2023-03-05 Thread Greg Wooledge
On Sun, Mar 05, 2023 at 02:37:48PM -0600, David Wright wrote: > There are many lists of dangerous aliases on the web, but I haven't > found a list of such aliases that can't be transcribed into functions. Here's one document: https://www.chiark.greenend.org.uk/~sgtatham/aliases.html

Re: alias in bash script issue

2023-03-05 Thread David Wright
On Sat 04 Mar 2023 at 12:23:58 (-0500), Greg Wooledge wrote: > On Sat, Mar 04, 2023 at 11:14:39AM -0600, David Wright wrote: > > > This use is discouraged > > > > There's a place for warning about the use of aliases in, say, > > Greg's BashPitfalls, or books, but not here. > > Discouraging th

Re: alias in bash script issue

2023-03-05 Thread tomas
On Sun, Mar 05, 2023 at 02:19:38PM +0100, Nicolas George wrote: > Tom Browder (12023-03-05): > > Yes, but please use its new name, Raku. Note new releases come out monthly > > so you shouldn't use the Debian packages since they are way behind. We have > > a member on the release team who provides D

Re: alias in bash script issue

2023-03-05 Thread Nicolas George
Tom Browder (12023-03-05): > Yes, but please use its new name, Raku. Note new releases come out monthly > so you shouldn't use the Debian packages since they are way behind. We have > a member on the release team who provides Debian packages as "rakudo-pkg" > so apt/aptitude update/upgrade work as

Re: alias in bash script issue

2023-03-05 Thread tomas
On Sun, Mar 05, 2023 at 07:30:18PM +0800, Ken Young wrote: > Is perl6 production ready? Of course. But be aware that it is quite a different language. > I have not used perl for a long time. If you prefer the "old" Perl (I do, for... reasons), it's still being maintained actively, too. Cheers -

Re: alias in bash script issue

2023-03-05 Thread Tom Browder
On Sun, Mar 5, 2023 at 05:30 Ken Young wrote: > Is perl6 production ready? > Yes, but please use its new name, Raku. Note new releases come out monthly so you shouldn't use the Debian packages since they are way behind. We have a member on the release team who provides Debian packages as "rakudo

Re: alias in bash script issue

2023-03-05 Thread Ken Young
Is perl6 production ready? I have not used perl for a long time. Sincerely, Ken Young On Sun, Mar 5, 2023 at 7:28 PM Tom Browder wrote: > My take: > > I use aliases heavily in my shell (bash), but I rarely use bash scripting > at all. > > For any serious scripting, since about 2016 I'ved used

Re: alias in bash script issue

2023-03-05 Thread Tom Browder
My take: I use aliases heavily in my shell (bash), but I rarely use bash scripting at all. For any serious scripting, since about 2016 I'ved used Raku (formerly Perl 6). Before that I used Perl. Both are much easier to use. -Tom

Re: alias in bash script issue

2023-03-04 Thread Greg Wooledge
; root@nxacloud-bloghost:~# echo $SHELL > > /bin/bash Both statements are correct, within their contexts. The default *interactive* shell for user accounts is /bin/bash. The default /bin/sh symlink (for scripts using #!/bin/sh, etc.) is dash. The author of a script chooses whether the sheba

Re: alias in bash script issue

2023-03-04 Thread Ken Young
On Sat, Mar 4, 2023 at 5:53 PM David wrote: > On Sat, 4 Mar 2023 at 19:30, Ken Young wrote: > > > Do you know why my alias can't work in the bash script? > > The info is as follows. > > > > 1) this alias does exist > > $ alias |grep 'k=' &

Re: alias in bash script issue

2023-03-04 Thread Greg Wooledge
On Sat, Mar 04, 2023 at 11:14:39AM -0600, David Wright wrote: > > This use is discouraged > > There's a place for warning about the use of aliases in, say, > Greg's BashPitfalls, or books, but not here. Discouraging the use of legacy features that are considered dangerous in modern usage is f

Re: alias in bash script issue

2023-03-04 Thread David Wright
On Sat 04 Mar 2023 at 20:52:15 (+1100), David wrote: > Hi. Friends don't help friends to do bad things :) > > Debian's default shell is 'dash'. Its manual, readable using 'man dash', > says > > Aliases provide a convenient way for naive users to create shorthands > for commands without h

Re: alias in bash script issue

2023-03-04 Thread Greg Wooledge
oing will advise. Do you mean this: For almost every purpose, aliases are superseded by shell functions. Your statements are so incredibly vague that I can't tell what you're trying to say. In any case, the Subject: header still says "bash script", and in bash scripts, al

Re: alias in bash script issue

2023-03-04 Thread David
On Sun, 5 Mar 2023 at 00:12, Tom Furie wrote: > On Sat, Mar 04, 2023 at 08:52:15PM +1100, David wrote: > > Debian's default shell is 'dash'. Its manual, readable using 'man dash', > > says > > The script explicitly calls bash. The rest of your point is still > (coincidentally) valid though, as it

Re: alias in bash script issue

2023-03-04 Thread Tom Furie
On Sat, Mar 04, 2023 at 08:52:15PM +1100, David wrote: > Debian's default shell is 'dash'. Its manual, readable using 'man dash', > says The script explicitly calls bash. The rest of your point is still (coincidentally) valid though, as it would be in most of the popular shells as far as I'm aware

Re: alias in bash script issue

2023-03-04 Thread David
On Sat, 4 Mar 2023 at 19:30, Ken Young wrote: > Do you know why my alias can't work in the bash script? > The info is as follows. > > 1) this alias does exist > $ alias |grep 'k=' > alias k='minikube kubectl --' > > 2) it also exists in .bash_pro

Re: alias in bash script issue

2023-03-04 Thread tomas
On Sat, Mar 04, 2023 at 10:23:24AM +0100, Kamil Jońca wrote: > Ken Young writes: > [..] > > I am not bash expert (prefer zsh) but as far as I know they are > expadnded during interactive session only, not in scripts. That's at least what the man page says (man bash(1)): ALIASES Aliases allo

Re: alias in bash script issue

2023-03-04 Thread Kamil Jońca
Ken Young writes: [..] I am not bash expert (prefer zsh) but as far as I know they are expadnded during interactive session only, not in scripts. > > $ ./get.sh  > > ./get.sh: line 5: k: command not found > https://www.gnu.org/software/bash/manual/bash.html#Aliases --8<---cut here-

alias in bash script issue

2023-03-04 Thread Ken Young
Hello, Do you know why my alias can't work in the bash script? The info is as follows. 1) this alias does exist $ alias |grep 'k=' alias k='minikube kubectl --' 2) it also exists in .bash_profile $ cat ~/.bash_profile |grep 'k=' alias k="minik

Re: (v) ugly (and simple) bash script...

2022-05-21 Thread john doe
On 5/21/2022 3:55 PM, Greg Wooledge wrote: On Sat, May 21, 2022 at 10:08:42AM +0100, Morgan Read wrote: I've come up with: `cd ~/Maildir/new/; for f in *; do mv -- "$f" ~/Maildir/cur/"${f%}.eml"; cd -; done` You aren't checking whether the first cd succeeds. If it fails for any reason, you're

Re: (v) ugly (and simple) bash script...

2022-05-21 Thread Dan Ritter
Greg Wooledge wrote: > On Sat, May 21, 2022 at 10:08:42AM +0100, Morgan Read wrote: > > I've come up with: > > `cd ~/Maildir/new/; for f in *; do mv -- "$f" ~/Maildir/cur/"${f%}.eml"; cd > > -; done` > > You aren't checking whether the first cd succeeds. If it fails for any > reason, you're goin

Re: (v) ugly (and simple) bash script...

2022-05-21 Thread Greg Wooledge
On Sat, May 21, 2022 at 10:08:42AM +0100, Morgan Read wrote: > I've come up with: > `cd ~/Maildir/new/; for f in *; do mv -- "$f" ~/Maildir/cur/"${f%}.eml"; cd > -; done` You aren't checking whether the first cd succeeds. If it fails for any reason, you're going to end up moving file(s) out of wh

Re: Bash script last 4 folder delete

2021-10-12 Thread Gokan Atmaca
> unicorn:~$ mkdir /tmp/x && cd "$_" > unicorn:/tmp/x$ mkdir 98 99 100 101 102 103 104 > unicorn:/tmp/x$ echo * > 100 101 102 103 104 98 99 Hello Gred Very thanks. Worked :) Best regards... On Tue, Oct 12, 2021 at 7:04 PM Greg Wooledge wrote: > > On Tue, Oct 12, 2021 at 05:41:59PM +0300, Goka

Re: Bash script last 4 folder delete

2021-10-12 Thread Greg Wooledge
On Tue, Oct 12, 2021 at 05:41:59PM +0300, Gokan Atmaca wrote: > I have directories created at different times. This last updated > directory is in the directory with a symbolic link named "last". > Directories are named from 100 to 110. what i want is to delete all > directories except the folder n

Re: Bash script last 4 folder delete

2021-10-12 Thread David Wright
On Tue 12 Oct 2021 at 17:41:59 (+0300), Gokan Atmaca wrote: > > I have directories created at different times. This last updated > directory is in the directory with a symbolic link named "last". > Directories are named from 100 to 110. what i want is to delete all > directories except the folder

Bash script last 4 folder delete

2021-10-12 Thread Gokan Atmaca
Hello I have directories created at different times. This last updated directory is in the directory with a symbolic link named "last". Directories are named from 100 to 110. what i want is to delete all directories except the folder named "last" and 4 before it. How can I do that? Exampe_folder_

Re: Bash script problem

2021-08-06 Thread Gregory Seidman

Re: Bash script problem

2021-08-06 Thread tomas
On Fri, Aug 06, 2021 at 07:52:20AM -0700, Gary L. Roach wrote: > > On 8/5/21 1:15 PM, Greg Wooledge wrote: [...] > >>You're doing *way* too much work. It's a gigantic X-Y problem. > I agree. I'm going back through the code and rewriting most of it. OTOH... this is how most learning journeys st

Re: Bash script problem

2021-08-06 Thread Gary L. Roach
On 8/5/21 1:15 PM, Greg Wooledge wrote: On Thu, Aug 05, 2021 at 01:03:16PM -0700, Gary L. Roach wrote: First, the IFS command sets the string separator. The default values are space /n and one other. The / is not among them. Yes, we know that. The issue is that you are setting IFS for the wh

Re: Bash script problem

2021-08-06 Thread Darac Marjal
On 06/08/2021 00:30, David wrote: > On Fri, 6 Aug 2021 at 06:03, Gary L. Roach wrote: > >> Second, why am I separating out the Path the way I am doing? I need to >> check each level for existence then, if the level doesn't exist, create >> the directory, cd to the directory, set chown and -x chmo

Re: Bash script problem

2021-08-05 Thread tomas
On Fri, Aug 06, 2021 at 10:52:51AM +1000, David wrote: [...] > I was commenting on how I have always been puzzled why > someone made the effort to give 'chmod' an '-R' option, but > never made it actually useful for common cases. As it is, > it seems that it's really only useful for modifying the

Re: Bash script problem

2021-08-05 Thread David
On Fri, 6 Aug 2021 at 13:06, David Wright wrote: > On Fri 06 Aug 2021 at 09:30:17 (+1000), David wrote: > > 'chmod -R' is less useful because it does not discriminate > > between files and directories, I never understood why it > > does not offer that option, because usually we need all file > >

Re: Bash script problem

2021-08-05 Thread David Wright
On Fri 06 Aug 2021 at 09:30:17 (+1000), David wrote: > On Fri, 6 Aug 2021 at 06:03, Gary L. Roach wrote: > > > Second, why am I separating out the Path the way I am doing? I need to > > check each level for existence then, if the level doesn't exist, create > > the directory, cd to the directory,

Re: Bash script problem

2021-08-05 Thread Greg Wooledge
On Thu, Aug 05, 2021 at 09:47:04PM -0400, The Wanderer wrote: > I believe I've hit contexts in which I could use '-print0 | xargs -0' > but couldn't figure out a way to get the job done with '-exec', because > I needed the command which was being run to process the output to be a > pipeline. (I no

Re: Bash script problem

2021-08-05 Thread The Wanderer
On 2021-08-05 at 20:25, Greg Wooledge wrote: >> >> find . -type d -exec chmod -v 0644 '{}' \; > >> > Use + instead of \; to make them more efficient. > >> What does + make as a difference ? > > It's a replacement for xargs, except that it actually works, unlike > xargs, which is horribly broken

Re: Bash script problem

2021-08-05 Thread David
On Fri, 6 Aug 2021 at 10:58, Christian Groessler wrote: > On 8/6/21 2:52 AM, David wrote: > > I was commenting on how I have always been puzzled why > > someone made the effort to give 'chmod' an '-R' option, but > > never made it actually useful for common cases. As it is, > > it seems that it's

Re: Bash script problem

2021-08-05 Thread Greg Wooledge
On Fri, Aug 06, 2021 at 02:58:00AM +0200, Christian Groessler wrote: > On 8/6/21 2:52 AM, David wrote: > > I was commenting on how I have always been puzzled why > > someone made the effort to give 'chmod' an '-R' option, but > > never made it actually useful for common cases. As it is, > > it seem

Re: Bash script problem

2021-08-05 Thread Christian Groessler
On 8/6/21 2:52 AM, David wrote: I was commenting on how I have always been puzzled why someone made the effort to give 'chmod' an '-R' option, but never made it actually useful for common cases. As it is, it seems that it's really only useful for modifying the write attribute. Hmm. "chmod -R go

Re: Bash script problem

2021-08-05 Thread David
On Fri, 6 Aug 2021 at 10:01, Polyna-Maude Racicot-Summerside wrote: > On 2021-08-05 7:30 p.m., David wrote: > > On Fri, 6 Aug 2021 at 06:03, Gary L. Roach wrote: > > 'chmod -R' is less useful because it does not discriminate > > between files and directories, I never understood why it > > does n

Re: Bash script problem

2021-08-05 Thread Christian Groessler
On 8/6/21 2:01 AM, Polyna-Maude Racicot-Summerside wrote: find . -type d -exec chmod -v 0644 '{}' \; to change the folder find . -type f -exec chmod -v 0755 '{}' \; to change files Pah. Use 'xargs' :-) $ find . -type f -print0 | xargs -0 chmod 644 $ find . -type d -print0 | xargs -0 chmod

Re: Bash script problem

2021-08-05 Thread Greg Wooledge
> >> find . -type d -exec chmod -v 0644 '{}' \; > > Use + instead of \; to make them more efficient. > What does + make as a difference ? It's a replacement for xargs, except that it actually works, unlike xargs, which is horribly broken without GNU extensions. find . -type d -exec chmod 755 {}

Re: Bash script problem

2021-08-05 Thread Polyna-Maude Racicot-Summerside
Hi, On 2021-08-05 8:07 p.m., Greg Wooledge wrote: > On Thu, Aug 05, 2021 at 08:01:22PM -0400, Polyna-Maude Racicot-Summerside > wrote: >> find . -type d -exec chmod -v 0644 '{}' \; >> >> to change the folder >> >> find . -type f -exec chmod -v 0755 '{}' \; >> >> to change files > > You've switch

Re: Bash script problem

2021-08-05 Thread Greg Wooledge
On Thu, Aug 05, 2021 at 08:01:22PM -0400, Polyna-Maude Racicot-Summerside wrote: > find . -type d -exec chmod -v 0644 '{}' \; > > to change the folder > > find . -type f -exec chmod -v 0755 '{}' \; > > to change files You've switched the permissions around. You want 644 on the files, and 755 o

Re: Bash script problem

2021-08-05 Thread Polyna-Maude Racicot-Summerside
Hi, On 2021-08-05 7:30 p.m., David wrote: > On Fri, 6 Aug 2021 at 06:03, Gary L. Roach wrote: > >> Second, why am I separating out the Path the way I am doing? I need to >> check each level for existence then, if the level doesn't exist, create >> the directory, cd to the directory, set chown an

Re: Bash script problem

2021-08-05 Thread David
On Fri, 6 Aug 2021 at 06:03, Gary L. Roach wrote: > Second, why am I separating out the Path the way I am doing? I need to > check each level for existence then, if the level doesn't exist, create > the directory, cd to the directory, set chown and -x chmod. After that > check the next level and

Re: Bash script problem

2021-08-05 Thread Tom Browder
On Wed, Aug 4, 2021 at 18:58 Gary L. Roach wrote: > Hi all; > I have just recently delved into the magical world of Bash scripting and I long ago gave up bash scripting for other than simple scripts, even for sysadmin chores. Most Linux distros, including our favorite Debian, come with Perl in

Re: Bash script problem

2021-08-05 Thread Greg Wooledge
On Thu, Aug 05, 2021 at 01:03:16PM -0700, Gary L. Roach wrote: > First, the IFS command sets the string separator. The default values are > space /n and one other. The / is not among them. Yes, we know that. The issue is that you are setting IFS for the whole script, when you probably *should* be

Re: Bash script problem

2021-08-05 Thread Gary L. Roach
hi all; I really appreciate all of your help. The file now works. See attached. Now t0 answer some questions. First, the IFS command sets the string separator. The default values are space /n and one other. The / is not among them. If I don't set the delimiter before I do the read, the whol

Re: test vs. [ [was: Bash script problem]

2021-08-05 Thread tomas
On Thu, Aug 05, 2021 at 08:32:39AM -0400, Greg Wooledge wrote: > On Thu, Aug 05, 2021 at 01:59:06PM +0200, to...@tuxteam.de wrote: > > On Thu, Aug 05, 2021 at 07:19:11AM -0400, Greg Wooledge wrote: > > > The external versions of test and [ need to exist for POSIX conformance, > > > and also so that

Re: test vs. [ [was: Bash script problem]

2021-08-05 Thread Greg Wooledge
On Thu, Aug 05, 2021 at 01:59:06PM +0200, to...@tuxteam.de wrote: > On Thu, Aug 05, 2021 at 07:19:11AM -0400, Greg Wooledge wrote: > > The external versions of test and [ need to exist for POSIX conformance, > > and also so that you can -exec them from find(1) or other similar > > programs. > > I

Re: Bash script problem

2021-08-05 Thread Greg Wooledge
On Wed, Aug 04, 2021 at 08:47:30PM -0700, Gary L. Roach wrote: > Thanks for the help but I still have the problem of the if statement always > being true. This time I enclosed the file so you can test it. You didn't make the changes that I told you to make yesterday. But this has already been cov

test vs. [ [was: Bash script problem]

2021-08-05 Thread tomas
On Thu, Aug 05, 2021 at 07:19:11AM -0400, Greg Wooledge wrote: > On Thu, Aug 05, 2021 at 10:07:12AM +0200, to...@tuxteam.de wrote: > > [1] Nowadays this is a little white lie: most shells have them > >as builtins, but they are supposed to behave like regular > >programs, for compat. There /

Re: Bash script problem

2021-08-05 Thread Greg Wooledge
On Thu, Aug 05, 2021 at 10:38:47AM +0200, to...@tuxteam.de wrote: > On Thu, Aug 05, 2021 at 09:26:35AM +0100, Tixy wrote: > > ; has no special meaning inside "". The expression is true because > > there is only a single non-null argument between the [ ] Precisely. But you're probably not explaini

Re: Bash script problem

2021-08-05 Thread Greg Wooledge
On Thu, Aug 05, 2021 at 10:07:12AM +0200, to...@tuxteam.de wrote: > [1] Nowadays this is a little white lie: most shells have them >as builtins, but they are supposed to behave like regular >programs, for compat. There /is/ a /bin/test, but I can't >find a /bin/[ on my system anymore.

Re: Bash script problem

2021-08-05 Thread tomas
On Thu, Aug 05, 2021 at 09:26:35AM +0100, Tixy wrote: > On Thu, 2021-08-05 at 10:36 +0300, Anssi Saari wrote: > [...] > > > > [ A="0 ; " ] > > > > is always true. It seems it probably has something to do with expansion, > > quoting and the special meaning of ;. > > > > ; has no special meaning

Re: Bash script problem

2021-08-05 Thread Tixy
On Thu, 2021-08-05 at 10:36 +0300, Anssi Saari wrote: [...] > > [ A="0 ; " ] > > is always true. It seems it probably has something to do with expansion, > quoting and the special meaning of ;. > ; has no special meaning inside "". The expression is true because there is only a single non-null

Re: Bash script problem

2021-08-05 Thread tomas
On Wed, Aug 04, 2021 at 08:47:30PM -0700, Gary L. Roach wrote: > Thanks for the help but I still have the problem of the if statement > always being true. This time I enclosed the file so you can test it. Please, don't top quote. It confuses the hell out of me. Now, I think in your script if t

Re: Bash script problem

2021-08-05 Thread Anssi Saari
send back an Awk or Sed statement that is more efficient. I am > having enough trouble with the Bash script. Well, are trying to check the existence of each part of each path element? So for example, first check /Test exists, then /Test/gary, then /Test/gary/run and so on? Because just checking the

Re: Bash script problem

2021-08-04 Thread john doe
On 8/5/2021 5:47 AM, Gary L. Roach wrote: Thanks for the help but I still have the problem of the if statement always being true. This time I enclosed the file so you can test it. Two things: - Why is the var 'IFS' set above the read command? - What are you trying to do here? -- John Doe

Re: Bash script problem

2021-08-04 Thread Gary L. Roach
Thanks for the help but I still have the problem of the if statement always being true. This time I enclosed the file so you can test it. Gary R On 8/4/21 5:04 PM, Greg Wooledge wrote: On Wed, Aug 04, 2021 at 04:58:00PM -0700, Gary L. Roach wrote: Path="/Test/gary/run/something" IFS=/ read -a

Re: Bash script problem

2021-08-04 Thread Greg Wooledge
On Wed, Aug 04, 2021 at 04:58:00PM -0700, Gary L. Roach wrote: > Path="/Test/gary/run/something" > IFS=/ > read -a Array <<< $Path You're setting IFS permanently for the whole script. It's usually better to set it only for the duration of the single read command which uses it. Also, read should

Bash script problem

2021-08-04 Thread Gary L. Roach
aving enough trouble with the Bash script. Something is wrong with the logic of the if-fi statement. It is triggered every time through the loop. The statement A="0;  " seems to be true no matter what the value of A. The if statement is there to clear out the first item in the array t

Re: Temporary color prompt in bash script

2019-09-03 Thread David Wright
On Tue 03 Sep 2019 at 14:20:11 (-0400), Greg Wooledge wrote: > On Tue, Sep 03, 2019 at 01:07:08PM -0500, David Wright wrote: > > Trap is designed to break the sequential flow of commands. > > I can't see any reason to do that when the OP wants the > > sequence: > > > > execute a script > >

Re: Temporary color prompt in bash script

2019-09-03 Thread Greg Wooledge
On Tue, Sep 03, 2019 at 01:07:08PM -0500, David Wright wrote: > Trap is designed to break the sequential flow of commands. > I can't see any reason to do that when the OP wants the > sequence: > > execute a script > print a string Are you actually able to discern the OP's desires? I can'

Re: Temporary color prompt in bash script

2019-09-03 Thread David Wright
On Tue 03 Sep 2019 at 15:07:43 (+), Larry Dighera wrote: > On Mon, 02 Sep 2019 08:48:50 +0200, Computer Planet > > wrote: > > >Is It possible to print of a string at the exit of a bash script? > > Have a look at `man bash` and search for 'trap.' Trap i

Fw: Temporary color prompt in bash script

2019-09-03 Thread Larry Dighera
On Mon, 02 Sep 2019 08:48:50 +0200, Computer Planet wrote: >Is It possible to print of a string at the exit of a bash script? Have a look at `man bash` and search for 'trap.' trap [-lp] [[arg] sigspec ...]               The command arg is to be read and executed when the s

Re: Temporary color prompt in bash script

2019-09-02 Thread David Wright
st your wishes). We don't read minds. > Now, I ask the question in other terms: > Is It possible to print of a string at the exit of a bash script? > e.g.: user@mypc: # bash script has just finished! [prompt] > with the prompt that remains immediately after the string printed. >

Re: Temporary color prompt in bash script

2019-09-02 Thread tomas
On Mon, Sep 02, 2019 at 09:30:44AM +0200, Thomas Schmitt wrote: > Hi, > > Computer Planet wrote: > > Is It possible to print of a string at the exit of a bash script? > > e.g.: user@mypc: # bash script has just finished! [prompt] > > with the prompt that remains i

Re: Temporary color prompt in bash script

2019-09-02 Thread Thomas Schmitt
Hi, Computer Planet wrote: > Is It possible to print of a string at the exit of a bash script? > e.g.: user@mypc: # bash script has just finished! [prompt] > with the prompt that remains immediately after the string printed. Do you mean something like this ? $ echo -n 'use

Re: Temporary color prompt in bash script

2019-09-02 Thread tomas
On Mon, Sep 02, 2019 at 08:48:50AM +0200, Computer Planet wrote: > Thanks guys, > but this is not the solution I'm looking for ... > Now, I ask the question in other terms: > Is It possible to print of a string at the exit of a bash script? Hm. You mean echo Still a bit con

Re: Temporary color prompt in bash script

2019-09-01 Thread Computer Planet
Thanks guys, but this is not the solution I'm looking for ... Now, I ask the question in other terms: Is It possible to print of a string at the exit of a bash script? e.g.: user@mypc: # bash script has just finished! [prompt] with the prompt that remains immediately after the string pr

Re: Temporary color prompt in bash script

2019-09-01 Thread tomas
On Sun, Sep 01, 2019 at 03:22:32PM -0400, Lee wrote: [...] > You have to source the script instead of running it. Yes, exactly. > I'm not entirely clear about a new shell gets it's own env that > disappears when the shell exits thing, but try this: It's not only a shell thing. It's a basic Uni

Re: Temporary color prompt in bash script

2019-09-01 Thread Lee
On 9/1/19, Computer Planet wrote: > Hi guys! > I'm trying, trying and trying but... > > How I Can put in hte end of a bash script this command: > PS1="\[\e]0;\u@\h: > \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w >

Re: Temporary color prompt in bash script

2019-09-01 Thread David Wright
On Sun 01 Sep 2019 at 17:53:51 (+0200), Computer Planet wrote: > Hi guys! > I'm trying, trying and trying but... > > How I Can put in hte end of a bash script this command: > PS1="\[\e]0;\u@\h: > \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[

Temporary color prompt in bash script

2019-09-01 Thread Computer Planet
Hi guys! I'm trying, trying and trying but... How I Can put in hte end of a bash script this command: PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w #\[\033[91m\] " so that after finishing the script the prompt wi

Re: Strange Bash Script Problem

2019-08-12 Thread David
On Tue, 13 Aug 2019 at 05:04, Lee wrote: > On 8/12/19, Greg Wooledge wrote: > > On Mon, Aug 12, 2019 at 01:56:46PM -0400, Lee wrote: >> What's the difference between ${d} and "${d}"? Or is that a bashism >> also? (all my scripts use /bin/sh so I'm pretty clueless wrt bash) > > > > For more deta

Re: Strange Bash Script Problem

2019-08-12 Thread Lee
On 8/12/19, Greg Wooledge wrote: > On Mon, Aug 12, 2019 at 01:56:46PM -0400, Lee wrote: >> What's the difference between ${d} and "${d}"? Or is that a bashism >> also? (all my scripts use /bin/sh so I'm pretty clueless wrt bash) > > This applies to both sh and bash. > > An unquoted substitution,

Re: Strange Bash Script Problem

2019-08-12 Thread Greg Wooledge
On Mon, Aug 12, 2019 at 01:56:46PM -0400, Lee wrote: > What's the difference between ${d} and "${d}"? Or is that a bashism > also? (all my scripts use /bin/sh so I'm pretty clueless wrt bash) This applies to both sh and bash. An unquoted substitution, like $d or ${d}, undergoes several steps. T

Re: Strange Bash Script Problem

2019-08-12 Thread Lee
On 8/12/19, Greg Wooledge wrote: > On Mon, Aug 12, 2019 at 01:37:16PM -0400, Lee wrote: >> On 8/12/19, Greg Wooledge wrote: >> > On Mon, Aug 12, 2019 at 01:19:45PM -0400, Lee wrote: >> >> On 8/12/19, Greg Wooledge wrote: >> >> > P.S. it would also have been possible to work around the carriage >

Re: Strange Bash Script Problem

2019-08-12 Thread Greg Wooledge
On Mon, Aug 12, 2019 at 01:37:16PM -0400, Lee wrote: > On 8/12/19, Greg Wooledge wrote: > > On Mon, Aug 12, 2019 at 01:19:45PM -0400, Lee wrote: > >> On 8/12/19, Greg Wooledge wrote: > >> > P.S. it would also have been possible to work around the carriage > >> > return > >> > issues with IFS, but

Re: Strange Bash Script Problem

2019-08-12 Thread Lee
On 8/12/19, Greg Wooledge wrote: > On Mon, Aug 12, 2019 at 01:19:45PM -0400, Lee wrote: >> On 8/12/19, Greg Wooledge wrote: >> > P.S. it would also have been possible to work around the carriage >> > return >> > issues with IFS, but your dos2unix approach is perfectly valid as well. >> >> Just ou

Re: Strange Bash Script Problem

2019-08-12 Thread Greg Wooledge
On Mon, Aug 12, 2019 at 01:19:45PM -0400, Lee wrote: > On 8/12/19, Greg Wooledge wrote: > > P.S. it would also have been possible to work around the carriage return > > issues with IFS, but your dos2unix approach is perfectly valid as well. > > Just out of curiosity - how? while IFS=$' \t\r\n' r

Re: Strange Bash Script Problem

2019-08-12 Thread Lee
On 8/12/19, Greg Wooledge wrote: > On Sun, Aug 11, 2019 at 02:10:06PM -0400, Stephen P. Molnar wrote: >> Thanks to all that shared their expertise. >> >> #!/bin/bash >> while IFS= read -r d >> do >> cd "${d}_apo-3k9b" >> echo "${d}_apo-3k9b" >> echo "${d}_apo-3k9b.dpf" >> /home/com

Re: Strange Bash Script Problem

2019-08-12 Thread Stephen P. Molnar
On 08/12/2019 09:39 AM, Greg Wooledge wrote: On Sun, Aug 11, 2019 at 02:10:06PM -0400, Stephen P. Molnar wrote: Thanks to all that shared their expertise. #!/bin/bash while IFS= read -r d do cd "${d}_apo-3k9b" echo "${d}_apo-3k9b" echo "${d}_apo-3k9b.dpf" /home/comp/Apps/

Re: Strange Bash Script Problem

2019-08-12 Thread Greg Wooledge
On Sun, Aug 11, 2019 at 02:10:06PM -0400, Stephen P. Molnar wrote: > Thanks to all that shared their expertise. > > #!/bin/bash > while IFS= read -r d > do > cd "${d}_apo-3k9b" > echo "${d}_apo-3k9b" > echo "${d}_apo-3k9b.dpf" > /home/comp/Apps/Autodock/autodock4 -p "${d}_apo-3k9b.

Re: Strange Bash Script Problem

2019-08-11 Thread Stephen P. Molnar
On 08/11/2019 11:56 AM, Lee wrote: On 8/11/19, David wrote: On Mon, 12 Aug 2019 at 01:07, Stephen P. Molnar wrote: Thanks for the suggestion. However, comp@AbNormal:~/Apps/Models/1-PhosphorusLigands/Acetylcholinesterases/3K9B/Results$ ./Run.ligand.list.sh ./Run.ligand.list.sh: line 4: c

Re: Strange Bash Script Problem

2019-08-11 Thread Lee
On 8/11/19, David wrote: > On Mon, 12 Aug 2019 at 01:07, Stephen P. Molnar > wrote: >> >> Thanks for the suggestion. >> However, >> comp@AbNormal:~/Apps/Models/1-PhosphorusLigands/Acetylcholinesterases/3K9B/Results$ >> ./Run.ligand.list.sh >> ./Run.ligand.list.sh: line 4: cd: $'Acetylcholine\r_ap

Re: Strange Bash Script Problem

2019-08-11 Thread David
On Mon, 12 Aug 2019 at 01:07, Stephen P. Molnar wrote: > > Thanks for the suggestion. > However, > comp@AbNormal:~/Apps/Models/1-PhosphorusLigands/Acetylcholinesterases/3K9B/Results$ > ./Run.ligand.list.sh > ./Run.ligand.list.sh: line 4: cd: $'Acetylcholine\r_apo-3k9b': No such > file or directory

Re: Strange Bash Script Problem

2019-08-11 Thread Stephen P. Molnar
On 08/11/2019 10:39 AM, David wrote: On Sun, 11 Aug 2019 at 23:18, Stephen P. Molnar wrote: I am running an up-to-date installation of Buster on my Linux platform and have run into a strange problem with a bash script. [...] for d in $(cat ligand.list) This line is the problem, it is

Re: Strange Bash Script Problem

2019-08-11 Thread David
On Sun, 11 Aug 2019 at 23:18, Stephen P. Molnar wrote: > > I am running an up-to-date installation of Buster on my Linux platform > and have run into a strange problem with a bash script. [...] > for d in $(cat ligand.list) This line is the problem, it is vulnerable to vari

Re: Strange Bash Script Problem

2019-08-11 Thread tomas
On Sun, Aug 11, 2019 at 09:17:53AM -0400, Stephen P. Molnar wrote: > I am running an up-to-date installation of Buster on my Linux > platform and have run into a strange problem with a bash script. > > I have a number of ligand protein docking applications which involve > ligand se

Strange Bash Script Problem

2019-08-11 Thread Stephen P. Molnar
I am running an up-to-date installation of Buster on my Linux platform and have run into a strange problem with a bash script. I have a number of ligand protein docking applications which involve ligand sets docking on a protein and am using Autodock with the the Racoon file editor (https

Re: Disable and Enable Screensaver via Bash Script

2018-10-17 Thread to...@tuxteam.de
On Wed, Oct 17, 2018 at 06:43:38PM +, Matthew Crews wrote: [...] > Makes sense to me. So I would probably need to use a FOR or WHILE loop of > some kind to periodically check if my application is running. Would need to > play around with it. > > Something else it looks like I could do is:

Re: Disable and Enable Screensaver via Bash Script

2018-10-17 Thread Matthew Crews
y screen saver. Caffeine indicator > > doesn't work with XFCE as far as I've been able to tell, so if I want to > > temporarily disable the screensaver I need to do so manually, and > > re-enable it manually. > > I'm wondering, is there a way to perform this featur

Re: Disable and Enable Screensaver via Bash Script

2018-10-16 Thread Étienne Mollier
). I presently use Xscreensaver for my screen saver. >>> Caffeine indicator doesn't work with XFCE as far as I've >>> been able to tell, so if I want to temporarily disable the >>> screensaver I need to do so manually, and re-enable it >>> manually. >&

Re: Disable and Enable Screensaver via Bash Script

2018-10-16 Thread Cindy-Sue Causey
doesn't work with XFCE as far as I've been able to tell, so if I want to >> temporarily disable the screensaver I need to do so manually, and >> re-enable it manually. >> >> I'm wondering, is there a way to perform this feature with a bash >> script?

Re: Disable and Enable Screensaver via Bash Script

2018-10-16 Thread tomas
to tell, so if I want to > temporarily disable the screensaver I need to do so manually, and > re-enable it manually. > > I'm wondering, is there a way to perform this feature with a bash > script? What I'm looking for is a bash script that does the following, > in se

  1   2   3   4   5   6   >