Re: ctrl-p not working as expected at bash command prompt on debian docker container
On 2021-04-26 02:43 PM, Steve Dondley wrote: I downloaded and ran this docker image: https://hub.docker.com/_/debian It works, but typically when I hit the ctrl-p key at the bash prompt, it acts like the up arrow key and shows the previous command. However, I have to hit ctrl-p twice to show the previous command and twice each time to show the next previous command. Ctrl-n works as expected with each single stroke going to the next command. The debian machine doesn't have a lot of packages installed so I'm guessing there is some basic config package I need to install. Does anyone have any idea? OK, issue fixed with: https://stackoverflow.com/a/41820278/1641112 Basically, modify the ~/.docker/config.json with somethis line: "detachKeys": "ctrl-@",
ctrl-p not working as expected at bash command prompt on debian docker container
I downloaded and ran this docker image: https://hub.docker.com/_/debian It works, but typically when I hit the ctrl-p key at the bash prompt, it acts like the up arrow key and shows the previous command. However, I have to hit ctrl-p twice to show the previous command and twice each time to show the next previous command. Ctrl-n works as expected with each single stroke going to the next command. The debian machine doesn't have a lot of packages installed so I'm guessing there is some basic config package I need to install. Does anyone have any idea?
Re: Bash command completion
On 7 July 2016 at 08:06, Lisi Reiszwrote: > > So have you followed the suggestion to test whether it is in fact bash that > you are in fact using? > > lisi@Tux-II:~$ echo $SHELL > /bin/bash > lisi@Tux-II:~$ In case anyone is unaware, it might be generally helpful to clarify what this test actually does. Here's a demo on my system: # my login shell is bash: [david@kablamm]$ echo $SHELL /bin/bash # now I run dash [david@kablamm]$ dash # now repeat the above test, inside dash: $ echo $SHELL /bin/bash $ # and now I type ^D to return to the login bash [david@kablamm]$ Which demonstrates that $SHELL does not report the running shell. It reports the user's login shell. Which might be different to whatever shell the echo command happens to be typed into. $SHELL is not controlled by the running shell. It is supplied to it in its runtime environment. $SHELL is set by 'login' process and exported to child processes. It is set to the value specified in /etc/passwd. This is mentioned in 'man 1 login'. Many shells are not capable of identifying themselves directly. bash can do it like this: [david@kablamm]$ echo $BASH_VERSION Neither sh nor dash have this capability.
Re: Bash command completion
> On Jul 6, 2016, at 11:33 PM, Peter Ludikovskywrote: > > No, chsh changes the login shell for the user within /etc/passwd. It > won't affect any currently active shells. > > What happens when you do an > /bin/bash --login > That should start a login shell. If you still only get the tab > character, check if you've got the line > set -o vi > in /etc/profile, /etc/bash*, ~/.profile, or ~/.bash* anywhere. Fired up the naughty computer, changed the /bin/sh link back to dash, did a chsh to /bin/bash in /etc/passwd, rebooted. Worked like a champ. The question now is who/what put /bin/sh in /etc/passwd... Thank you all for your comments and help. This was making me crazy. I've learned IP and *nix on my own, and I get to know the corners by trial and error. This one was a pretty trivial, but beyond what I could figure out. Thanks all, I've learned a new corner... Sure am glad I didn't have to deal with MS tech support :-) -- Glenn English
Re: Bash command completion
No, chsh changes the login shell for the user within /etc/passwd. It won't affect any currently active shells. What happens when you do an /bin/bash --login That should start a login shell. If you still only get the tab character, check if you've got the line set -o vi in /etc/profile, /etc/bash*, ~/.profile, or ~/.bash* anywhere. Am 07.07.2016 um 07:14 schrieb Glenn English: > >> On Jul 6, 2016, at 10:38 PM, Peter Ludikovskywrote: >> >> After an chsh, you have to log out & in again. > > I thought of that -- I logged out and back in, no joy. I rebooted, same thing. > > I wasn't too surprised. I assumed that rebooting the machine would just put > stuff back the way it was. And that the problem was with the scripts in the > user directories. > > That wasn't it, and I was working on the wrong things. Lisi's insight led me > to this afternoon's solution. And deloptes came up with another very > interesting thought (which I haven't investigated yet). > > Does chsh change things for good -- in passwd or in a shell var or a link? I > thought it just started a shell, as if it was just starting a new program. > signature.asc Description: OpenPGP digital signature
Re: Bash command completion
> On Jul 6, 2016, at 10:38 PM, Peter Ludikovskywrote: > > After an chsh, you have to log out & in again. I thought of that -- I logged out and back in, no joy. I rebooted, same thing. I wasn't too surprised. I assumed that rebooting the machine would just put stuff back the way it was. And that the problem was with the scripts in the user directories. That wasn't it, and I was working on the wrong things. Lisi's insight led me to this afternoon's solution. And deloptes came up with another very interesting thought (which I haven't investigated yet). Does chsh change things for good -- in passwd or in a shell var or a link? I thought it just started a shell, as if it was just starting a new program. -- Glenn English
Re: Bash command completion
After an chsh, you have to log out & in again. Am 07.07.2016 um 00:17 schrieb Glenn English: > >> On Jul 6, 2016, at 4:06 PM, Lisi Reiszwrote: >> >> So have you followed the suggestion to test whether it is in fact bash that >> you are in fact using? > > Yes. And I wasn't -- it was dash. > > So I: > > 'chsh -s /bin/bash' > 'ls Do\t' > > and got a tab. > >> lisi@Tux-II:~$ echo $SHELL >> /bin/bash >> lisi@Tux-II:~$ > > I'll try your codelet. Before and after chsh... > signature.asc Description: OpenPGP digital signature
Re: Bash command completion [Fixed]
> On Jul 6, 2016, at 5:59 PM, delopteswrote: > > What is the default for the user in /etc/passwd ? Good question. Another very likely error. And I'd answer it if the massively obsolete box wasn't powered down and in the give-away bin :-) I'll look into it tomorrow. -- Glenn English
Re: Bash command completion [Fixed]
Glenn English wrote: > >> On Jul 6, 2016, at 4:06 PM, Lisi Reiszwrote: > > There were far too many 'sh's in scripts in /etc, so I changes /bin/sh > from pointing at dash to pointing at bash. What is the default for the user in /etc/passwd ? > > That fixed it. > > Lisi, as usual, found the problem :-) >
Re: Bash command completion [Fixed]
> On Jul 6, 2016, at 4:06 PM, Lisi Reiszwrote: There were far too many 'sh's in scripts in /etc, so I changes /bin/sh from pointing at dash to pointing at bash. That fixed it. Lisi, as usual, found the problem :-) -- Glenn English
Re: Bash command completion
> On Jul 6, 2016, at 4:06 PM, Lisi Reiszwrote: > > lisi@Tux-II:~$ echo $SHELL > /bin/bash > lisi@Tux-II:~$ Ahah! As root, echo $SHELL says /bin/bash. As a user, it says /bin/sh. And sh is dash. That explains a *lot*. Maybe. I'll see if I can find the dastardly script that does that. Thanks Lisi. -- Glenn English
Re: Bash command completion
> On Jul 6, 2016, at 4:06 PM, Lisi Reiszwrote: > > So have you followed the suggestion to test whether it is in fact bash that > you are in fact using? Yes. And I wasn't -- it was dash. So I: 'chsh -s /bin/bash' 'ls Do\t' and got a tab. > lisi@Tux-II:~$ echo $SHELL > /bin/bash > lisi@Tux-II:~$ I'll try your codelet. Before and after chsh... -- Glenn English
Re: Bash command completion
On Wednesday 06 July 2016 22:52:58 Glenn English wrote: > > On Jul 6, 2016, at 2:29 PM, Charlie Kravetz> > wrote: > > > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA256 > > > > There should be a set of commands towards the bottom > > of /etc/bash.bashrc to enable completion. The commands are: > > > > # enable bash completion in interactive shells > > #if ! shopt -oq posix; then > > # if [ -f /usr/share/bash-completion/bash_completion ]; then > > #. /usr/share/bash-completion/bash_completion > > # elif [ -f /etc/bash_completion ]; then > > #. /etc/bash_completion > > # fi > > #fi > > There were. > > > You usually have to uncomment these lines. > > I did and logged out and back in, and rebooted, but no change; it's still > bent. So have you followed the suggestion to test whether it is in fact bash that you are in fact using? lisi@Tux-II:~$ echo $SHELL /bin/bash lisi@Tux-II:~$ Lisi
Re: Bash command completion
> On Jul 6, 2016, at 3:16 PM, Sven Arvidssonwrote: > > Are you sure that your user uses bash for the login shell? There was a > transition from bash to dash some releases ago. Nope. According to 'man sh', it's dash. I understood that dash is a fixed bash. But why would it work for root and not for a user? And why is it OK on all the other wheezy boxes around here? And how do I replace it? I'll poke around a bit more... -- Glenn English
Re: Bash command completion
> On Jul 6, 2016, at 2:29 PM, Charlie Kravetz> wrote: > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > There should be a set of commands towards the bottom > of /etc/bash.bashrc to enable completion. The commands are: > > # enable bash completion in interactive shells > #if ! shopt -oq posix; then > # if [ -f /usr/share/bash-completion/bash_completion ]; then > #. /usr/share/bash-completion/bash_completion > # elif [ -f /etc/bash_completion ]; then > #. /etc/bash_completion > # fi > #fi There were. > You usually have to uncomment these lines. I did and logged out and back in, and rebooted, but no change; it's still bent. -- Glenn English
Re: Bash command completion
On Wed, 2016-07-06 at 14:29 -0600, Charlie Kravetz wrote: > On Wed, 6 Jul 2016 13:48:24 -0600 > Glenn Englishwrote: > > > > > I put wheezy on a 386 computer last night ('aptitude dist-upgrade' > > from squeeze -- it'd been in the junk box for a while), and when I > > hit tab, bash just gives me a tab -- I have to type the whole > > command manually. This happens only for the user; root works fine. > > > > I've copied the .* scripts (the ones that looked relevant to me, > > anyway) from /root and from a user directory on one of the (wheezy) > > servers, and accomplished nothing. > > > > I looked at the scripts in /etc, but saw nothing that looked > > promising -- there was some talk about bash-completion, but I could > > see nothing in those scripts about a difference between user and > > root. > > > > A solution or a link to a solution would be much appreciated. > > > There should be a set of commands towards the bottom > of /etc/bash.bashrc to enable completion. The commands are: > > # enable bash completion in interactive shells > #if ! shopt -oq posix; then > # if [ -f /usr/share/bash-completion/bash_completion ]; then > #. /usr/share/bash-completion/bash_completion > # elif [ -f /etc/bash_completion ]; then > #. /etc/bash_completion > # fi > #fi That's for the bash-completion package. A normal bash shell should give completion for anything in PATH without it, and it sounds like even this doesn't work for the OP? Are you sure that your user uses bash for the login shell? There was a transition from bash to dash some releases ago. -- Cheers, Sven Arvidsson http://www.whiz.se signature.asc Description: This is a digitally signed message part
Re: Bash command completion
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On Wed, 6 Jul 2016 13:48:24 -0600 Glenn Englishwrote: >I put wheezy on a 386 computer last night ('aptitude dist-upgrade' from >squeeze -- it'd been in the junk box for a while), and when I hit tab, bash >just gives me a tab -- I have to type the whole command manually. This happens >only for the user; root works fine. > >I've copied the .* scripts (the ones that looked relevant to me, anyway) from >/root and from a user directory on one of the (wheezy) servers, and >accomplished nothing. > >I looked at the scripts in /etc, but saw nothing that looked promising -- >there was some talk about bash-completion, but I could see nothing in those >scripts about a difference between user and root. > >A solution or a link to a solution would be much appreciated. > There should be a set of commands towards the bottom of /etc/bash.bashrc to enable completion. The commands are: # enable bash completion in interactive shells #if ! shopt -oq posix; then # if [ -f /usr/share/bash-completion/bash_completion ]; then #. /usr/share/bash-completion/bash_completion # elif [ -f /etc/bash_completion ]; then #. /etc/bash_completion # fi #fi You usually have to uncomment these lines. - -- Charlie Kravetz Linux Registered User Number 425914 [http://linuxcounter.net/user/425914.html] Never let anyone steal your DREAM. [http://keepingdreams.com] -BEGIN PGP SIGNATURE- Version: GnuPG v2 iQEcBAEBCAAGBQJXfWpEAAoJEIqui46mydCAsLwH/130072ceXgYS+L7azOWYV5G GiIRhRDYvV79MltABY/kqKflEcGZvZWWuTY3UgO+a1RuUupYjVJyhn8rDK/pwT2R Omb6oIDO+t6TcL42KnCHVwLIEQdIG6kW3BvU8YXFxfraytODPhwJl0QWgrlf3vuv Xn82XzjaDrKk/CsfmwLCM4kSL792XmXVciI22FMEWad2PuupIpRLCZOCclxVGTBf 2hdzdoSJF1L0PPDGOx9WmkQuEaU0C+DqpvD1UloiFZ6Z/tl2+qbfGmYTpo/SHcHV lDLTGvV8yzlfKQtA1PqJxbpnbweKScoaGYVAFZkSblPC7VCQOjuxKT7Po8LwXuI= =NbOP -END PGP SIGNATURE-
Bash command completion
I put wheezy on a 386 computer last night ('aptitude dist-upgrade' from squeeze -- it'd been in the junk box for a while), and when I hit tab, bash just gives me a tab -- I have to type the whole command manually. This happens only for the user; root works fine. I've copied the .* scripts (the ones that looked relevant to me, anyway) from /root and from a user directory on one of the (wheezy) servers, and accomplished nothing. I looked at the scripts in /etc, but saw nothing that looked promising -- there was some talk about bash-completion, but I could see nothing in those scripts about a difference between user and root. A solution or a link to a solution would be much appreciated. -- Glenn English
Re: bash command
On Fri, Oct 21, 2011 at 03:42:36PM -0400, Stefan Monnier wrote: Sadly, this can't be done in-place, so you'll either need to use mv to replace /etc/conf.file with /etc/conf.file.new or repeat the loop (with no substitution) to copy /etc/conf.file.new into /etc/conf.file. It can be done inplace with `rm' in place or `mv': (rm /etc/conf.file; while read line; do echo ${line/old_word/new_word} done /etc/conf.file) /etc/conf.file True, but that's using external tools. My point was that it's difficult to do simply with bash (which is what the OP asked for). If you're allowing the use of external tools, sed is much easier. -- Darac Marjal -- 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/20111024091007.ga6...@darac.org.uk
Re: bash command
Darac Marjal mailingl...@darac.org.uk writes: Sadly, this can't be done in-place, so you'll either need to use mv to replace /etc/conf.file with /etc/conf.file.new or repeat the loop (with no substitution) to copy /etc/conf.file.new into /etc/conf.file. Maybe now with bash, but with perl it can be done in place quite handily. perl -i -pe 's/WORDS/REPLACEMENT/' my.conf -- 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/87aa8uw5zy@newsguy.com
Re: bash command
Sadly, this can't be done in-place, so you'll either need to use mv to replace /etc/conf.file with /etc/conf.file.new or repeat the loop (with no substitution) to copy /etc/conf.file.new into /etc/conf.file. It can be done inplace with `rm' in place or `mv': (rm /etc/conf.file; while read line; do echo ${line/old_word/new_word} done /etc/conf.file) /etc/conf.file -- Stefan -- 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/jwvzkgucevp.fsf-monnier+gmane.linux.debian.u...@gnu.org
bash command
Hey guys, I want to create a script to change some words in some sonf files at the start up of the system...do you know the command in bash for search the word and replace it?? Thanks
Re: bash command
On Thu, Oct 20, 2011 at 09:29:35AM BST, Jesus arteche wrote: I want to create a script to change some words in some sonf files at the start up of the system...do you know the command in bash for search the word and replace it?? You don't need bash for it, sed's your friend, e.g.: % sed -i 's/old_word/new_word/' /etc/conf.file I highly recommend. % man sed Regards, -- Raf -- 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/20111020083650.ga17...@linuxstuff.pl
Re: bash command
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 20/10/11 09:29, Jesus arteche wrote: Hey guys, I want to create a script to change some words in some sonf files at the start up of the system...do you know the command in bash for search the word and replace it?? Well, I don't know about bash command but I know about sed. - -- |_|0|_| | |_|_|0| Heghlu'Meh QaQ jajVam | |0|0|0| kuLa - | gpg --keyserver pgp.mit.edu --recv-keys 0xC100B4CA -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOn923AAoJEOqHloDBALTKKWcIAL5mR6xh7lxo0OHfejjdu6o9 iX+hx0EMgJzvo89e7OacpypudyPAEnwj/hwwvEXYPQs2nABAXaGYFBjeKQlrjkeM 5X57kx127mpSMDS7hB4I1tH+L81mWwNEBowUmmAA5bzpaIt1r8pWflrNGHKUOh/F u0VgHWhCAQ52VhQvwHA+buMm9o3wXMyrRLxUbDeYaTJWe1BvWxlbhPUOUrWBwxu8 hSeewuRdUDjmnTsbSGisUU0xWZccgQHMXnuIfVLWHVfQeJC6/dVYSmYKI58zcGvH 6QWfh7ttFZbx50btHuRWGOyHwWMtWYS9i1QKP71VMyXXGTbgBbgqt4En0uRXGVs= =XBdl -END PGP SIGNATURE- -- 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/4e9fddb7.9080...@kulisz.net
Re: bash command
* 2011-10-20T09:29:35+01:00 * Jesus arteche wrote: I want to create a script to change some words in some sonf files at the start up of the system...do you know the command in bash for search the word and replace it?? Sounds like you need sed command and its s/.../.../ command. Probably sed's --in-place option will be useful. -- 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/871uu8vytw@mithlond.arda
Re: bash command
On Thu, Oct 20, 2011 at 09:36:50AM +0100, Raf Czlonka wrote: On Thu, Oct 20, 2011 at 09:29:35AM BST, Jesus arteche wrote: I want to create a script to change some words in some sonf files at the start up of the system...do you know the command in bash for search the word and replace it?? You don't need bash for it, sed's your friend, e.g.: % sed -i 's/old_word/new_word/' /etc/conf.file Proving that TIMTOWTDI (or, You don't need sed for it, bash's your friend): while read line; do echo ${line/old_word/new_word} done /etc/conf.file /etc/conf.file.new Sadly, this can't be done in-place, so you'll either need to use mv to replace /etc/conf.file with /etc/conf.file.new or repeat the loop (with no substitution) to copy /etc/conf.file.new into /etc/conf.file. By the way, I don't recommend this method. sed IS your friend, but bash IS capable and that's what you asked for :) -- Darac Marjal -- 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/20111020105421.gb7...@darac.org.uk
Re: bash command
kuLa (deb...@kulisz.net on 2011-10-20 09:37 +0100): On 20/10/11 09:29, Jesus arteche wrote: Hey guys, I want to create a script to change some words in some sonf files at the start up of the system...do you know the command in bash for search the word and replace it?? Well, I don't know about bash command but I know about sed. Theoretically it's possible with bash (=3) as well: $ VAR=oldword $ echo $VAR oldword $ echo ${VAR/old/new} newword And use a read loop over all the lines in the file :) Regards, Arno -- 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/20111020125802.1ea77...@neminis.loos.site
Re: bash command
On 10/20/2011 04:37 AM, kuLa wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 20/10/11 09:29, Jesus arteche wrote: Hey guys, I want to create a script to change some words in some sonf files at the start up of the system...do you know the command in bash for search the word and replace it?? Well, I don't know about bash command but I know about sed. - -- |_|0|_| | |_|_|0| Heghlu'Meh QaQ jajVam | |0|0|0| kuLa - | What the heck is that, Klingon? What does it mean? --doug gpg --keyserver pgp.mit.edu --recv-keys 0xC100B4CA -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ -- Blessed are the peacemakers...for they shall be shot at from both sides. --A. M. Greeley -- 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/4ea05ae4.50...@optonline.net
Re: bash command
On Thu, Oct 20, 2011 at 06:31:16PM BST, Doug wrote: |_|0|_| | |_|_|0| Heghlu'Meh QaQ jajVam | |0|0|0| kuLa - | What the heck is that, Klingon? What does it mean? --doug http://en.wikiquote.org/wiki/Klingon_proverbs -- Raf -- 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/20111020174429.ga29...@linuxstuff.pl
Re: bash command
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 20/10/11 18:31, Doug wrote: - -- |_|0|_| | |_|_|0| Heghlu'Meh QaQ jajVam | |0|0|0| kuLa - | What the heck is that, Klingon? What does it mean? --doug lol, yes it is :-) http://www.google.co.uk/search?aq=fgcx=csourceid=chromeclient=ubuntuchannel=csie=UTF-8q=Heghlu'Meh+QaQ+jajVam - -- |_|0|_| | |_|_|0| Heghlu'Meh QaQ jajVam | |0|0|0| kuLa - | gpg --keyserver pgp.mit.edu --recv-keys 0xC100B4CA -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) iQEcBAEBAgAGBQJOoGKRAAoJEOqHloDBALTKWJUH/iYna3AChWLrVFkltdIN2nPe oqXU78vrmZ4A+3iw8/R6FgPJVIlBhIrv7u0y13a+cYt9TBTsDP+a9uXKQHgoI3ft gdXuD4ZviGsjmbsMVLO5Pj/JzMbcjVTbNQA6m4SrQyfjbnVaV0RKZ3X3CRRbauG7 9uRVtfRcTY6fYGTNQwBH3O2F1J34m42l7YzCs1Ow5CthBEKd8lMFCQYloz2vd7DZ tAD/mKFEh8cqNXLC8ql+UObhzpeJ4SPZRWGTChfTyiF1rliEEFLId898UGJVGu1Q jYxwPrRluaaSFA4aj/8hKm5YfU7mptfFMjM1GhKGdAYcFHMDYTbIA9IxIXCN2AA= =cFRx -END PGP SIGNATURE- -- 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/4ea06291.5000...@kulisz.net
Re: ^C show up on bash command line
On 2010-09-28 03:25 +0200, T o n g wrote: Now,when pressing ^C to abolish changes to bash command, the actual ^C will show up where the cursor is. IIRC, previously it wasn't like this -- editing aborted with actual command intact, without being messed up with ^C. This looked like a bug to me, but it was actually added deliberately. Is it possible to get back the old bash ^C behaviour? $ echo 'set echo-control-characters off' ~/.inputrc See the following thread: http://lists.gnu.org/archive/html/bug-bash/2010-02/threads.html#00115 Sven -- 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/878w2mcr2v@turtle.gmx.de
Re: need help with bash command
François Cerbelle [EMAIL PROTECTED]: Bob McGowan a écrit : Why do this with a `ls` when a simple * will work? for a in *; do ... Hum... Because ! ;-) In fact, first, I used to do this, because I seldomly use all files in a single directory, but often a pattern in a whole tree with find, second because there was a ls in the original problem and third because I did Ah, the original homework problem? -- Any technology distinguishable from magic is insufficiently advanced. (*)http://blinkynet.net/comp/uip5.html Linux Counter #80292 - -http://www.faqs.org/rfcs/rfc1855.htmlPlease, don't Cc: me. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: need help with bash command
Le Ven 21 novembre 2008 02:10, Ding Honghui a écrit :.jpg [EMAIL PROTECTED]:~/test/jpg$ ls | awk -F_ '{print $2}' 3563 3616 3620 IMHO, awk is quite oversized just to cut fields... It is typically a cut job : cut -d_ -f2 ;-) Fanfan -- http://www.cerbelle.net - http://www.afdm-idf.org -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
need help with bash command
Hello, Can you help me with a bash command? I a directory, I want to extract with a command line for jpg name files. I have a lot of: icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg I want to extract the number betwen icon_*_0_1.jpg AND I want to use the entire filename too in the same command. The goal is to create a directory called 3620 and move the icon_3620_0_1.jpg file into this directory. So, I did like this for test: # for a in `ls | sed -e s'/_/ /g' | awk '{print $2}'`; do echo icon_$a_0_1.jpg; done I hope it should give me: icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg like the original BUT in my surprise, it shows: icon_.jpg icon_.jpg icon_.jpg icon_.jpg Why? Where is the $a_0_1 gone? Surely I missed something but I cannot find it. Can you tell me how to reproduce the exact filename so? Best regards, -- Tôba -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: need help with bash command
tôba escreveu: Hello, Can you help me with a bash command? I a directory, I want to extract with a command line for jpg name files. I have a lot of: icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg I want to extract the number betwen icon_*_0_1.jpg AND I want to use the entire filename too in the same command. The goal is to create a directory called 3620 and move the icon_3620_0_1.jpg file into this directory. So, I did like this for test: # for a in `ls | sed -e s'/_/ /g' | awk '{print $2}'`; do echo icon_$a_0_1.jpg; done Try icon_${a}_0_1.jpg Why it works is left as an exercise for the reader. (Hint: man bash). I hope it should give me: icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg like the original BUT in my surprise, it shows: icon_.jpg icon_.jpg icon_.jpg icon_.jpg Why? Where is the $a_0_1 gone? Surely I missed something but I cannot find it. Can you tell me how to reproduce the exact filename so? -- Eduardo M Kalinowski [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
[SOLVED] Re: need help with bash command
On Thu, 20 Nov 2008 13:28:17 -0200 Eduardo M KALINOWSKI [EMAIL PROTECTED] wrote: tôba escreveu: Hello, Can you help me with a bash command? I a directory, I want to extract with a command line for jpg name files. I have a lot of: icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg I want to extract the number betwen icon_*_0_1.jpg AND I want to use the entire filename too in the same command. The goal is to create a directory called 3620 and move the icon_3620_0_1.jpg file into this directory. So, I did like this for test: # for a in `ls | sed -e s'/_/ /g' | awk '{print $2}'`; do echo icon_$a_0_1.jpg; done Try icon_${a}_0_1.jpg Why it works is left as an exercise for the reader. (Hint: man bash). Ok, Thank you Eduardo, it works, Regards, -- Tôba -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: need help with bash command
Le Jeu 20 novembre 2008 16:18, tôba a écrit : icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg The goal is to create a directory called 3620 and move the icon_3620_0_1.jpg file into this directory. So, I did like this for test: # for a in `ls | sed -e s'/_/ /g' | awk '{print $2}'`; do echo icon_$a_0_1.jpg; done for a in `ls`; do DIR=`echo $a | cut -d_ -f2`; echo mkdir -p $DIR /$a; echo rmdir $DIR/$a; echo mv $a $DIR/$a; done First, compute the dirname to put the file in. Second, create a directory corresponding to the full destination path including the filename to create the parent directory if it does not exists Third, remove the directory with the name of the file Fourth, move the file The command line includes echo for you to see what will be done. When you want the job to be done, just remove the echo before mkdir, rmdir and mv. Fanfan -- http://www.cerbelle.net - http://www.afdm-idf.org -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: need help with bash command
On Thu, 2008-11-20 at 17:27 +0100, François Cerbelle wrote: Le Jeu 20 novembre 2008 16:18, tôba a écrit : icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg The goal is to create a directory called 3620 and move the icon_3620_0_1.jpg file into this directory. So, I did like this for test: # for a in `ls | sed -e s'/_/ /g' | awk '{print $2}'`; do echo icon_$a_0_1.jpg; done for a in `ls`; do DIR=`echo $a | cut -d_ -f2`; echo mkdir -p $DIR /$a; echo rmdir $DIR/$a; echo mv $a $DIR/$a; done ... Why do this with a `ls` when a simple * will work? for a in *; do ... -- Bob McGowan smime.p7s Description: S/MIME cryptographic signature
Re: need help with bash command
tôba wrote: Hello, Can you help me with a bash command? I a directory, I want to extract with a command line for jpg name files. I have a lot of: icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg I want to extract the number betwen icon_*_0_1.jpg AND I want to use the entire filename too in the same command. The goal is to create a directory called 3620 and move the icon_3620_0_1.jpg file into this directory. I am sure somebody would have solved this already, but here what I do in such a situation: #in the directory with the images. This will create dirs based on the #numbers in the image filenames and move that file to its corresponding #directory for f in icon__0_1.jpg; do num=`echo $f | sed -e 's/icon_\([0-9]*\)_0_1\.jpg/\1/'`; #get number mkdir ${num}; mv $f ${num}; done -- Please reply to this list only. I read this list on its corresponding newsgroup on gmane.org. Replies sent to my email address are just filtered to a folder in my mailbox and get periodically deleted without ever having been read. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: need help with bash command
Bob McGowan a écrit : for a in `ls`; do DIR=`echo $a | cut -d_ -f2`; echo mkdir -p $DIR /$a; echo rmdir $DIR/$a; echo mv $a $DIR/$a; done ... Why do this with a `ls` when a simple * will work? for a in *; do ... Hum... Because ! ;-) In fact, first, I used to do this, because I seldomly use all files in a single directory, but often a pattern in a whole tree with find, second because there was a ls in the original problem and third because I did not optimize the command ;-) I'm sure it is possible to replace the mkdir -p xxx; rmdir xxx with something better. For exemple in the problem, it was not needed, a simple mkdir would do the job. Fanfan -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: need help with bash command
tôba wrote: Hello, Can you help me with a bash command? I a directory, I want to extract with a command line for jpg name files. I have a lot of: icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg I want to extract the number betwen icon_*_0_1.jpg AND I want to use the entire filename too in the same command. The goal is to create a directory called 3620 and move the icon_3620_0_1.jpg file into this directory. So, I did like this for test: # for a in `ls | sed -e s'/_/ /g' | awk '{print $2}'`; do echo icon_$a_0_1.jpg; done I hope it should give me: icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg like the original BUT in my surprise, it shows: icon_.jpg icon_.jpg icon_.jpg icon_.jpg Why? Where is the $a_0_1 gone? Surely I missed something but I cannot find it. Can you tell me how to reproduce the exact filename so? Best regards, -- Tôba Hello, do you means like that? for a in `ls | sed -e s'/_/ /g' | awk '{print $2}'`; do echo icon_${a}_0_1.jpg; done A better way maybe is: [EMAIL PROTECTED]:~/test/jpg$ touch icon_3563_0_1.jpg icon_3616_0_1.jpg icon_3620_0_1.jpg [EMAIL PROTECTED]:~/test/jpg$ ls icon_3563_0_1.jpg icon_3616_0_1.jpg icon_3620_0_1.jpg [EMAIL PROTECTED]:~/test/jpg$ ls | awk -F_ '{print $2}' 3563 3616 3620 [EMAIL PROTECTED]:~/test/jpg$ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: need help with bash command
On Fri, 21 Nov 2008 09:10:08 +0800 Ding Honghui [EMAIL PROTECTED] wrote: tôba wrote: Hello, Can you help me with a bash command? I a directory, I want to extract with a command line for jpg name files. I have a lot of: icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg I want to extract the number betwen icon_*_0_1.jpg AND I want to use the entire filename too in the same command. The goal is to create a directory called 3620 and move the icon_3620_0_1.jpg file into this directory. So, I did like this for test: # for a in `ls | sed -e s'/_/ /g' | awk '{print $2}'`; do echo icon_$a_0_1.jpg; done I hope it should give me: icon_3620_0_1.jpg icon_3616_0_1.jpg icon_3563_0_1.jpg like the original BUT in my surprise, it shows: icon_.jpg icon_.jpg icon_.jpg icon_.jpg Why? Where is the $a_0_1 gone? Surely I missed something but I cannot find it. Can you tell me how to reproduce the exact filename so? Best regards, -- Tôba Hello, do you means like that? for a in `ls | sed -e s'/_/ /g' | awk '{print $2}'`; do echo icon_${a}_0_1.jpg; done A better way maybe is: [EMAIL PROTECTED]:~/test/jpg$ touch icon_3563_0_1.jpg icon_3616_0_1.jpg icon_3620_0_1.jpg [EMAIL PROTECTED]:~/test/jpg$ ls icon_3563_0_1.jpg icon_3616_0_1.jpg icon_3620_0_1.jpg [EMAIL PROTECTED]:~/test/jpg$ ls | awk -F_ '{print $2}' 3563 3616 3620 [EMAIL PROTECTED]:~/test/jpg$ Yes, I did like you suggested and it's already done now. Best regards, -- Tôba -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: bash command timer
Roberto C. Sanchez wrote: On Tue, Sep 26, 2006 at 05:19:47PM -0500, Hugo Vanwoerkom wrote: Ron Johnson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/25/06 13:54, Hugo Vanwoerkom wrote: Hi, I am looking for a way to time scripts, how long they take to execute. That has appeared in the list before, but now I can't find it. I could write it myself, but I bet it exists already. Are you referring to time(1)? $ time ./testmem Out of memory at 2802 M real0m0.020s user0m0.002s sys 0m0.017s Aha! I am and it is a package that I did not have installed ;-) Just remember that if you run time without a patch qualification, you get the shell's builtin time function. If you want to use the time binary, then be sure to specify /usr/bin/time. Regards, -Roberto I ran right into this when I did not specify /usr/bin/time. However... I do not think time is what I want. What I want is a chronometer function that works just like one: you click and it shows 0:00, click and it starts running, click and it shows how far it got... I wrote a command to do that and keep the elapsed time in a environment variable, but setenv(CHRONO, msecs.data(), 1)); does not set the variable $CHRONO, so I have to rethink. H -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: bash command timer
Ron Johnson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/25/06 13:54, Hugo Vanwoerkom wrote: Hi, I am looking for a way to time scripts, how long they take to execute. That has appeared in the list before, but now I can't find it. I could write it myself, but I bet it exists already. Are you referring to time(1)? $ time ./testmem Out of memory at 2802 M real0m0.020s user0m0.002s sys 0m0.017s Aha! I am and it is a package that I did not have installed ;-) Thanks! H -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: bash command timer
On Tue, Sep 26, 2006 at 05:19:47PM -0500, Hugo Vanwoerkom wrote: Ron Johnson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/25/06 13:54, Hugo Vanwoerkom wrote: Hi, I am looking for a way to time scripts, how long they take to execute. That has appeared in the list before, but now I can't find it. I could write it myself, but I bet it exists already. Are you referring to time(1)? $ time ./testmem Out of memory at 2802 M real0m0.020s user0m0.002s sys 0m0.017s Aha! I am and it is a package that I did not have installed ;-) Just remember that if you run time without a patch qualification, you get the shell's builtin time function. If you want to use the time binary, then be sure to specify /usr/bin/time. Regards, -Roberto -- Roberto C. Sanchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
bash command timer
Hi, I am looking for a way to time scripts, how long they take to execute. That has appeared in the list before, but now I can't find it. I could write it myself, but I bet it exists already. Thanks H -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: bash command timer
On Mon, Sep 25, 2006 at 01:54:53PM -0500, Hugo Vanwoerkom wrote: Hi, I am looking for a way to time scripts, how long they take to execute. That has appeared in the list before, but now I can't find it. I could write it myself, but I bet it exists already. Use /usr/bin/time, as the built-in time in bash is not very good. Regards, -Roberto -- Roberto C. Sanchez http://people.connexer.com/~roberto http://www.connexer.com signature.asc Description: Digital signature
Re: bash command timer
* Hugo Vanwoerkom [EMAIL PROTECTED] [060925 20:54]: I am looking for a way to time scripts, how long they take to execute. time? Yours sincerely, Alexander -- http://learn.to/quote/ http://www.catb.org/~esr/faqs/smart-questions.html signature.asc Description: Digital signature
Re: bash command timer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/25/06 13:54, Hugo Vanwoerkom wrote: Hi, I am looking for a way to time scripts, how long they take to execute. That has appeared in the list before, but now I can't find it. I could write it myself, but I bet it exists already. Are you referring to time(1)? $ time ./testmem Out of memory at 2802 M real0m0.020s user0m0.002s sys 0m0.017s - -- Ron Johnson, Jr. Jefferson LA USA Is common sense really valid? For example, it is common sense to white-power racists that whites are superior to blacks, and that those with brown skins are mud people. However, that common sense is obviously wrong. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFGEtRS9HxQb37XmcRAm+7AJ9o9PSis2SQRzTZ6F9J9Mz1TMD8zwCg7ETn +0igi/pNCo84tO4xlNnDD28= =5+5p -END PGP SIGNATURE- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
bash command substitution problem
I have a function defined in my .bashrc as: function lf { /bin/ls -l | grep ^- ; } It prints the files in the CWD without listing other directories. Suppose I want to 'chmod 600' all the files in the CWD without affecting directories, I try this: chmod 600 `lf` but I get this error: chmod: invalid character `w' in mode string `-rw---' What am I doing wrong? thanks 8) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: bash command substitution problem
Incoming from Pollywog: I have a function defined in my .bashrc as: function lf { /bin/ls -l | grep ^- ; } It prints the files in the CWD without listing other directories. Suppose I want to 'chmod 600' all the files in the CWD without affecting directories, I try this: chmod 600 `lf` but I get this error: chmod: invalid character `w' in mode string `-rw---' What am I doing wrong? You're passing it /bin/ls -l instead of /bin/ls. -l works in the function to pick up files only, but fails in chmod (you can't chmod 600 -rw-r--r--1 keeling keeling 5973 Oct 7 2004 .emacs. You have to chmod 600 .emacs. -- Any technology distinguishable from magic is insufficiently advanced. (*)http://www.spots.ab.ca/~keeling Please don't Cc: me. - - -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: bash command substitution problem
On Sunday 08 May 2005 04:52 pm, s. keeling wrote: You're passing it /bin/ls -l instead of /bin/ls. -l works in the function to pick up files only, but fails in chmod (you can't chmod 600 -rw-r--r--1 keeling keeling 5973 Oct 7 2004 .emacs. You have to chmod 600 .emacs. Back to the drawing board then. thanks 8) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: bash command substitution problem
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Pollywog said: I have a function defined in my .bashrc as: function lf { /bin/ls -l | grep ^- ; } It prints the files in the CWD without listing other directories. Suppose I want to 'chmod 600' all the files in the CWD without affecting directories, I try this: chmod 600 `lf` but I get this error: chmod: invalid character `w' in mode string `-rw---' yeah, the ls -l listing is getting you when you display. try this one. function lsf { for i in *; do if [ -f $i ]; then echo $i fi; done; } lsf | xargs chmod 600 - -- /phil -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.0 (MingW32) iD8DBQFCfkd9Gbd/rBLcaFwRAgfQAKCBtJmVZNChY7s2FaUYr2mJEV3xPACgwiUz bgYxqBS+OoFekcHkXaDM8Sw= =lB4T -END PGP SIGNATURE- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: bash command substitution problem
On Sunday 08 May 2005 05:08 pm, Phil Dyer wrote: try this one. function lsf { for i in *; do if [ -f $i ]; then echo $i fi; done; } lsf | xargs chmod 600 Thanks, that works. 8) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
bash command history
Is there any way to get bash to work like 4dos? -- If you type the first couple of characters of a command in history, it will only scroll through those commands begining with those characters... -Paul -- TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to [EMAIL PROTECTED] . Trouble? e-mail to [EMAIL PROTECTED] .
Re: bash command history
On Sat, 09 Aug 1997 02:22:32 EDT Paul Miller ([EMAIL PROTECTED]) wrote: Is there any way to get bash to work like 4dos? -- If you type the first couple of characters of a command in history, it will only scroll through those commands begining with those characters... ^R aka CTRL-R man readline Phil. -- TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to [EMAIL PROTECTED] . Trouble? e-mail to [EMAIL PROTECTED] .