This is a discussion on VI question within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 In alt.os.linux.slackware, notbob dared to utter, > the first time I tried it ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 In alt.os.linux.slackware, notbob dared to utter, > the first time I tried it with regular apostrophes, nada. But with the left > hand apostrophe, voila! Why does this work. ...or at least point me to a > read. man bash? Because single quotes tell the shell to do absolutely no interpretation of what is inside them. So: # echo $SHELL /bin/bash # echo '$SHELL' $SHELL Backticks tell the shell to execute what's between them first and substitute the results in its place. # ls 'which vi' File not found # ls `which vi` /usr/bin/vi - -- It is better to hear the rebuke of the wise, Than for a man to hear the song of fools. Ecclesiastes 7:5 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFBU44ElKR45I6cfKARAl+JAKClnwkqn/gDfArLyUfBSijj+nv8dwCfSHkA KEOkTssMsJrdw8rKZtotDDI= =/KTM -----END PGP SIGNATURE----- |
| |||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 notbob wrote: | On 2004-09-22, Blumf <blumf@hot.mail.com> wrote: | | |>$ ls -l `which vi` |>lrwxrwxrwx 1 root root 5 2004-07-10 18:41 /usr/bin/vi -> elvis | | | Wow. What a neat command. Like a shortcut pipe. Works from anywhere. But, | the first time I tried it with regular apostrophes, nada. But with the left | hand apostrophe, voila! Why does this work. ...or at least point me to a | read. man bash? | | nb The backticks substitute the output of the inner command into the command line. Thus, $ ls -l `which vi` is the same as: $ which vi /usr/bin/vi [cut-n-paste '/usr/bin/vi'] $ ls -l /usr/bin/vi lrwxrwxrwx 1 root root 5 2004-07-10 18:41 /usr/bin/vi -> elvis Of course, this is dead handy for shell scripts that *can't* cut-and-paste otherwise. It's all in the bash manual, but I recommend info rather than man, even though I usually prefer man pages. HTH, Ross -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBU5HS9bR4xmappRARAtW8AJ9vaUvsMcYb9u8cl0EGTb 4dCddPSQCgoTNf aRy5mNfMTOeKi+b0Zo0bPlU= =fCI9 -----END PGP SIGNATURE----- |
| |||
| On 2004-09-24, Ross Kendall Axe <ross.axe@blueyonder.co.uk> wrote: > The backticks substitute the output of the inner command into the > command line. Nice, succinct, explanation, and I thank you for that. OTOH, it doesn't seem to be reliable. When used with "cups" instead of "vi", it gives me a whole bunch of: which: no cups in (/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/opt/kde/bin:/usr/lib/qt/bin:/usr/share/texmf/bin:.:/home/notbob/bin:/bin:/sbin) .....and then throws in my whole home directory to boot, like I'd issued a regular ls -al. Then, to make things worse, I can't even cut'n paste the command to show what I did, as it seems backticks in jed under Konsole not only don't translate under cut'n paste, they don't even translate, a bunch of ^'s replacing them. It appears I have a wandered into a whole new quagmire of *nix sophistry (why am I not surprised? thingie is one bodacious powerful mo'chickie. I'll flog it as soon as I get my samba print server up. nb ...samba go, printer no |
| |||
| On 2004-09-22, Mark Hill <mrhill@gmail.com> wrote: > On Wed, 22 Sep 2004 10:04:40 GMT, > Ed LaBonte <ed@NOSPAMlabonte.com> wrote: >> Elvis is the default vi editor with >> slackware. Is this because it has some advantages over vim or is it >> because it is closer to the original vi? > > I'd imagine it's because Elvis is closer to the original vi, and > therefore more what a new user would expect from typing 'vi'. > >> What are its advantages over vim >> (if any)? I was looking thru the docs for elvis and I noticed it talked about some things I hadn't seen before. I never paid much attention to it- it's just a plain, bare-bones VI clone, right? Well, I downloaded and recompiled it from source. I was amazed to see that it's alot like Vim, with sytax highlighting, selectable colors, themes, and it can even use background XPM's (it reminds me of an Eterm window). When under X11, it runs in it's own window as well, with a scroll bar, toolbar, mouse support, cut & paste- everything. If you should still want to, it runs in text mode and can restrict itself to the old bare-bones VI style. I knew that some Slack editors don't include all their features by default, but I really had no idea elvis was this nice of an editor. Now I use it as much or more than some of my others. If you're looking to try a "new" editor, compile elvis from the sources with the X support and all its feature left in. The URL is in the man page, and there are a bunch of themes there for it as well. It can even download them directly, and read html pages of the 'Net. -- --- SIGSEGV (Segmentation fault) @ 0 (0) --- +++ killed by SIGSEGV +++ |
| |||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 notbob wrote: > On 2004-09-24, Ross Kendall Axe <ross.axe@blueyonder.co.uk> wrote: > >> The backticks substitute the output of the inner command into the >> command line. > > Nice, succinct, explanation, and I thank you for that. OTOH, it doesn't > seem to be reliable. When used with "cups" instead of "vi", it gives me a > whole bunch of: > > which: no cups in > (/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:...<snip> There is no cups executable, hence 'which' tells you it can't find it in the given $PATH. cupsd exists: # which cupsd /usr/sbin/cupsd Also, just noticed this myself, apparently the backquotes are to be phased out in favor of $() so 'ls -l $(which vi)' is the hip new way to do things. http://www.tldp.org/LDP/abs/html/commandsub.html /usr/doc/Linux-HOWTOs/Bash-Prompt-HOWTO (section 3.3) Blumf -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBU+R8Mid3IcxolsoRAl2aAJkBTS22HizbDqoPjJ6VxW ySRIwVpACeNUqT IvzoaAkA12TmrtPh3LxJ8pE= =aWEQ -----END PGP SIGNATURE----- |
| |||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 In alt.os.linux.slackware, Blumf dared to utter, > Also, just noticed this myself, apparently the backquotes are to be phased > out in favor of $() so 'ls -l $(which vi)' is the hip new way to do things. Not just the new hip way, the new better way. $() can be layered, whereas backticks cannot. For example: $(which ls $(which cupsd)) # will work `which ls `which cupsd`` # will not Ouput is something like: /bin/ls /usr/sbin/cupsd /bin/ls which cupsd - -- It is better to hear the rebuke of the wise, Than for a man to hear the song of fools. Ecclesiastes 7:5 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFBVBj6lKR45I6cfKARAvdHAKCmjxW2I+prCOmLnWPYRU 41+nNNngCcDdfO KNLH1/96zEFXuLupEn26zyM= =DXnD -----END PGP SIGNATURE----- |
| |||
| pgp trash troll delete Hicks, Alan 188 Shady Dale Dr Lizella, GA 31052 478-935-8132 +Alan Hicks+ <alan@lizella.network> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > In alt.os.linux.slackware, notbob dared to utter, >> the first time I tried it with regular apostrophes, nada. But with the left >> hand apostrophe, voila! Why does this work. ...or at least point me to a >> read. man bash? > > Because single quotes tell the shell to do absolutely no interpretation > of what is inside them. So: > > # echo $SHELL > /bin/bash > # echo '$SHELL' > $SHELL > > Backticks tell the shell to execute what's between them first and > substitute the results in its place. > > # ls 'which vi' > File not found > # ls `which vi` > /usr/bin/vi > > - -- > It is better to hear the rebuke of the wise, > Than for a man to hear the song of fools. > Ecclesiastes 7:5 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.1 (GNU/Linux) > > iD8DBQFBU44ElKR45I6cfKARAl+JAKClnwkqn/gDfArLyUfBSijj+nv8dwCfSHkA > KEOkTssMsJrdw8rKZtotDDI= > =/KTM > -----END PGP SIGNATURE----- |
| |||
| NOTE: This message was sent thru a mail2news gateway. No effort was made to verify the identity of the sender. -------------------------------------------------------- pgp trash troll delete Hicks, Alan 188 Shady Dale Dr Lizella, GA 31052 478-935-8132 +Alan Hicks+ <alan@lizella.network> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > In alt.os.linux.slackware, Blumf dared to utter, >> Also, just noticed this myself, apparently the backquotes are to be phased >> out in favor of $() so 'ls -l $(which vi)' is the hip new way to do things. > > Not just the new hip way, the new better way. $() can be layered, > whereas backticks cannot. For example: > > $(which ls $(which cupsd)) # will work > `which ls `which cupsd`` # will not > > Ouput is something like: > > /bin/ls /usr/sbin/cupsd > /bin/ls which cupsd > > - -- > It is better to hear the rebuke of the wise, > Than for a man to hear the song of fools. > Ecclesiastes 7:5 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.1 (GNU/Linux) > > iD8DBQFBVBj6lKR45I6cfKARAvdHAKCmjxW2I+prCOmLnWPYRU 41+nNNngCcDdfO > KNLH1/96zEFXuLupEn26zyM= > =DXnD > -----END PGP SIGNATURE----- |
| |||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 _.-In alt.os.linux.slackware, +Alan Hicks+ wrote the following -._ > Not just the new hip way, the new better way. $() can be layered, > whereas backticks cannot. For example: > > $(which ls $(which cupsd)) # will work > `which ls `which cupsd`` # will not Not only is nesting[0] possible with $() but the $() makes the code a who lot easier to read. Sometimes that means more than anything. [0] layered? Layering happins in a stack. Not in command subsitituion. - -- .-')) http://asciipr0n.com/fp ('-. | It's a damn poor mind that ' ..- .:" ) ( ":. -.. ' | can only think of one way to ((,,_;'.;' UIN=66618055 ';. ';_,,)) | spell a word. ((_.YIM=Faux_Pseudo :._)) | - Andrew Jackson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBV0HpSJec2PH9pbURAtg2AJ9l7gU+oXWTQZ08if5rYz 4uuwS4zACeP6IN /2Eta2N/yk7Kueb0Tc9kr0I= =cuVj -----END PGP SIGNATURE----- |
| ||||
| On 2004-09-26, Faux_Pseudo <Faux_Pseudo@yahoo.comERCIAL> wrote: >> Not just the new hip way, the new better way. $() can be layered, > Not only is nesting[0] possible with $() but the $() makes the code a I can see the advantages, but how is it the "new" hip way? I've started learning bash programming and the bash-programming-intro-howto advises $(), mentioning left ticks as an afterthought, and it's 4 years old. nb |