* [gentoo-user] [A bit off-topic] Bash alias and & @ 2016-06-12 14:26 Andrew Lowe 2016-06-12 14:33 ` Nico Verrijdt 2016-06-13 9:49 ` Joerg Schilling 0 siblings, 2 replies; 12+ messages in thread From: Andrew Lowe @ 2016-06-12 14:26 UTC (permalink / raw To: gentoo-user Hi all, A bit off topic here, but there are plenty of people who seem to know their shells back to front so here goes. I have set up a Win32 based development environment, bash/cc/ls/etc/etc, for 1st year Engineering students who have to learn C on a command line. It's fine for me to remember to put the & at the end of the command when I fire up the editor but for them, it's major angst. The first thing that comes to mind is an alias. Just off the top of my head I tried: alias "npp=npp %1 &" npp being the editor, but that didn't work. Is an alias the best/easiest way to do this and if so, what would the syntax be, or is there a better way? Any thoughts, greatly appreciated, Andrew ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] [A bit off-topic] Bash alias and & 2016-06-12 14:26 [gentoo-user] [A bit off-topic] Bash alias and & Andrew Lowe @ 2016-06-12 14:33 ` Nico Verrijdt 2016-06-12 14:43 ` Alan McKinnon 2016-06-13 9:49 ` Joerg Schilling 1 sibling, 1 reply; 12+ messages in thread From: Nico Verrijdt @ 2016-06-12 14:33 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: text/plain, Size: 930 bytes --] Hi Andrew, 2016-06-12 16:26 GMT+02:00 Andrew Lowe <agl@wht.com.au>: > Hi all, > A bit off topic here, but there are plenty of people who seem to > know their shells back to front so here goes. > > I have set up a Win32 based development environment, > bash/cc/ls/etc/etc, for 1st year Engineering students who have to learn C > on a command line. It's fine for me to remember to put the & at the end of > the command when I fire up the editor but for them, it's major angst. > > The first thing that comes to mind is an alias. Just off the top > of my head I tried: > > alias "npp=npp %1 &" > Shouldn't this be: alias npp="npp %1 &" ? > npp being the editor, but that didn't work. Is an alias the best/easiest > way to do this and if so, what would the syntax be, or is there a better > way? > > Any thoughts, greatly appreciated, > > Andrew > > Hope this helps, Nico [-- Attachment #2: Type: text/html, Size: 1546 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] [A bit off-topic] Bash alias and & 2016-06-12 14:33 ` Nico Verrijdt @ 2016-06-12 14:43 ` Alan McKinnon 2016-06-12 15:07 ` Andrew Lowe 0 siblings, 1 reply; 12+ messages in thread From: Alan McKinnon @ 2016-06-12 14:43 UTC (permalink / raw To: gentoo-user On 12/06/2016 16:33, Nico Verrijdt wrote: > Hi Andrew, > > 2016-06-12 16:26 GMT+02:00 Andrew Lowe <agl@wht.com.au > <mailto:agl@wht.com.au>>: > > Hi all, > A bit off topic here, but there are plenty of people who > seem to know their shells back to front so here goes. > > I have set up a Win32 based development environment, > bash/cc/ls/etc/etc, for 1st year Engineering students who have to > learn C on a command line. It's fine for me to remember to put the & > at the end of the command when I fire up the editor but for them, > it's major angst. > > The first thing that comes to mind is an alias. Just off > the top of my head I tried: > > alias "npp=npp %1 &" > > Shouldn't this be: alias npp="npp %1 &" ? > > > npp being the editor, but that didn't work. Is an alias the > best/easiest way to do this and if so, what would the syntax be, or > is there a better way? > > Any thoughts, greatly appreciated, > > Andrew > > > Hope this helps, > Nico Or just tell them to remember to add the & at the end. With an alias what will they do when they don't want it? Or look at it this way: It's syntax, it's important. C is probably more syntax-critical than any other language around (binds to the right, anyone?) so what's the problem with requiring correct syntax on the command line as well? Obligatory disclaimer: I've recently had a bellyache full of dumb people who insist I put code when a human (themselves) belongs... ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] [A bit off-topic] Bash alias and & 2016-06-12 14:43 ` Alan McKinnon @ 2016-06-12 15:07 ` Andrew Lowe 2016-06-12 15:54 ` [SOLVED]Re: " Andrew Lowe 2016-06-12 17:04 ` [gentoo-user] " Peter Humphrey 0 siblings, 2 replies; 12+ messages in thread From: Andrew Lowe @ 2016-06-12 15:07 UTC (permalink / raw To: gentoo-user On 06/12/16 22:43, Alan McKinnon wrote: > On 12/06/2016 16:33, Nico Verrijdt wrote: >> Hi Andrew, >> >> 2016-06-12 16:26 GMT+02:00 Andrew Lowe <agl@wht.com.au >> <mailto:agl@wht.com.au>>: >> >> Hi all, >> A bit off topic here, but there are plenty of people who >> seem to know their shells back to front so here goes. >> >> I have set up a Win32 based development environment, >> bash/cc/ls/etc/etc, for 1st year Engineering students who have to >> learn C on a command line. It's fine for me to remember to put the & >> at the end of the command when I fire up the editor but for them, >> it's major angst. >> >> The first thing that comes to mind is an alias. Just off >> the top of my head I tried: >> >> alias "npp=npp %1 &" >> >> Shouldn't this be: alias npp="npp %1 &" ? >> >> >> npp being the editor, but that didn't work. Is an alias the >> best/easiest way to do this and if so, what would the syntax be, or >> is there a better way? >> >> Any thoughts, greatly appreciated, >> >> Andrew >> >> >> Hope this helps, >> Nico > > > Or just tell them to remember to add the & at the end. > With an alias what will they do when they don't want it? > > Or look at it this way: > > It's syntax, it's important. C is probably more syntax-critical than any > other language around (binds to the right, anyone?) so what's the > problem with requiring correct syntax on the command line as well? > > Obligatory disclaimer: I've recently had a bellyache full of dumb people > who insist I put code when a human (themselves) belongs... > Yes, I agree BUT, this is a "half subject" in a common first year of an Engineering degree. These are people who will become Civil/Mechanical/Electrical/Chemical Engineers and they have no desire to learn programming. To put it bluntly, all they are interested in is their car, getting drunk and trying to get a root - the order may vary, but that is the top three priorities. Anything else is just too much to think about. In reality, I'm doing this to make my life easier. As much as I tell them to do something, write up documents that tell them what to do and reiterate what they have to do, I still get the question "It's broken, it won't do as I want...." Andrew p.s. Nico's point was a typo on my part in the email. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [SOLVED]Re: [gentoo-user] [A bit off-topic] Bash alias and & 2016-06-12 15:07 ` Andrew Lowe @ 2016-06-12 15:54 ` Andrew Lowe 2016-06-12 19:06 ` [gentoo-user] Re: [SOLVED]Re: " Jonathan Callen 2016-06-12 17:04 ` [gentoo-user] " Peter Humphrey 1 sibling, 1 reply; 12+ messages in thread From: Andrew Lowe @ 2016-06-12 15:54 UTC (permalink / raw To: gentoo-user On 06/12/16 23:07, Andrew Lowe wrote: > On 06/12/16 22:43, Alan McKinnon wrote: >> On 12/06/2016 16:33, Nico Verrijdt wrote: >>> Hi Andrew, >>> >>> 2016-06-12 16:26 GMT+02:00 Andrew Lowe <agl@wht.com.au >>> <mailto:agl@wht.com.au>>: >>> >>> Hi all, >>> A bit off topic here, but there are plenty of people who >>> seem to know their shells back to front so here goes. >>> >>> I have set up a Win32 based development environment, >>> bash/cc/ls/etc/etc, for 1st year Engineering students who have to >>> learn C on a command line. It's fine for me to remember to put the & >>> at the end of the command when I fire up the editor but for them, >>> it's major angst. >>> >>> The first thing that comes to mind is an alias. Just off >>> the top of my head I tried: >>> >>> alias "npp=npp %1 &" >>> >>> Shouldn't this be: alias npp="npp %1 &" ? >>> >>> >>> npp being the editor, but that didn't work. Is an alias the >>> best/easiest way to do this and if so, what would the syntax be, or >>> is there a better way? >>> >>> Any thoughts, greatly appreciated, >>> >>> Andrew >>> >>> >>> Hope this helps, >>> Nico >> >> >> Or just tell them to remember to add the & at the end. >> With an alias what will they do when they don't want it? >> >> Or look at it this way: >> >> It's syntax, it's important. C is probably more syntax-critical than any >> other language around (binds to the right, anyone?) so what's the >> problem with requiring correct syntax on the command line as well? >> >> Obligatory disclaimer: I've recently had a bellyache full of dumb people >> who insist I put code when a human (themselves) belongs... >> > Yes, I agree BUT, this is a "half subject" in a common first year of > an Engineering degree. These are people who will become > Civil/Mechanical/Electrical/Chemical Engineers and they have no desire > to learn programming. To put it bluntly, all they are interested in is > their car, getting drunk and trying to get a root - the order may vary, > but that is the top three priorities. Anything else is just too much to > think about. > > In reality, I'm doing this to make my life easier. As much as I tell > them to do something, write up documents that tell them what to do and > reiterate what they have to do, I still get the question "It's broken, > it won't do as I want...." > > Andrew > > p.s. Nico's point was a typo on my part in the email. > Simple answer to this which a single google search found. You CAN'T pass parameters to an alias under Bash. You need to do a function. A simple function of: npp() { npp $1 & } was all I needed. Andrew ^ permalink raw reply [flat|nested] 12+ messages in thread
* [gentoo-user] Re: [SOLVED]Re: [A bit off-topic] Bash alias and & 2016-06-12 15:54 ` [SOLVED]Re: " Andrew Lowe @ 2016-06-12 19:06 ` Jonathan Callen 2016-06-13 6:59 ` [gentoo-user] " Andrew Lowe 0 siblings, 1 reply; 12+ messages in thread From: Jonathan Callen @ 2016-06-12 19:06 UTC (permalink / raw To: gentoo-user [-- Attachment #1.1: Type: text/plain, Size: 3298 bytes --] On 06/12/2016 11:54 AM, Andrew Lowe wrote: > On 06/12/16 23:07, Andrew Lowe wrote: >> On 06/12/16 22:43, Alan McKinnon wrote: >>> On 12/06/2016 16:33, Nico Verrijdt wrote: >>>> Hi Andrew, >>>> >>>> 2016-06-12 16:26 GMT+02:00 Andrew Lowe <agl@wht.com.au >>>> <mailto:agl@wht.com.au>>: >>>> >>>> Hi all, >>>> A bit off topic here, but there are plenty of people who >>>> seem to know their shells back to front so here goes. >>>> >>>> I have set up a Win32 based development environment, >>>> bash/cc/ls/etc/etc, for 1st year Engineering students who have to >>>> learn C on a command line. It's fine for me to remember to put >>>> the & >>>> at the end of the command when I fire up the editor but for them, >>>> it's major angst. >>>> >>>> The first thing that comes to mind is an alias. Just off >>>> the top of my head I tried: >>>> >>>> alias "npp=npp %1 &" >>>> >>>> Shouldn't this be: alias npp="npp %1 &" ? >>>> >>>> >>>> npp being the editor, but that didn't work. Is an alias the >>>> best/easiest way to do this and if so, what would the syntax be, or >>>> is there a better way? >>>> >>>> Any thoughts, greatly appreciated, >>>> >>>> Andrew >>>> >>>> >>>> Hope this helps, >>>> Nico >>> >>> >>> Or just tell them to remember to add the & at the end. >>> With an alias what will they do when they don't want it? >>> >>> Or look at it this way: >>> >>> It's syntax, it's important. C is probably more syntax-critical than any >>> other language around (binds to the right, anyone?) so what's the >>> problem with requiring correct syntax on the command line as well? >>> >>> Obligatory disclaimer: I've recently had a bellyache full of dumb people >>> who insist I put code when a human (themselves) belongs... >>> >> Yes, I agree BUT, this is a "half subject" in a common first year of >> an Engineering degree. These are people who will become >> Civil/Mechanical/Electrical/Chemical Engineers and they have no desire >> to learn programming. To put it bluntly, all they are interested in is >> their car, getting drunk and trying to get a root - the order may vary, >> but that is the top three priorities. Anything else is just too much to >> think about. >> >> In reality, I'm doing this to make my life easier. As much as I tell >> them to do something, write up documents that tell them what to do and >> reiterate what they have to do, I still get the question "It's broken, >> it won't do as I want...." >> >> Andrew >> >> p.s. Nico's point was a typo on my part in the email. >> > > Simple answer to this which a single google search found. You CAN'T > pass parameters to an alias under Bash. You need to do a function. A > simple function of: > > npp() > { > npp $1 & > } > > was all I needed. > > Andrew > > A better function for the same (that also doesn't loop forever because the function might be calling itself): npp() { command npp "$@" & } This allows any number of arguments to be passed, instead of "exactly one" and allows filenames containing spaces, etc. to be passed correctly. -- Jonathan Callen [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* [gentoo-user] [SOLVED]Re: [A bit off-topic] Bash alias and & 2016-06-12 19:06 ` [gentoo-user] Re: [SOLVED]Re: " Jonathan Callen @ 2016-06-13 6:59 ` Andrew Lowe 0 siblings, 0 replies; 12+ messages in thread From: Andrew Lowe @ 2016-06-13 6:59 UTC (permalink / raw To: gentoo-user On 06/13/16 03:06, Jonathan Callen wrote: > On 06/12/2016 11:54 AM, Andrew Lowe wrote: >> On 06/12/16 23:07, Andrew Lowe wrote: >>> On 06/12/16 22:43, Alan McKinnon wrote: >>>> On 12/06/2016 16:33, Nico Verrijdt wrote: >>>>> Hi Andrew, >>>>> >>>>> 2016-06-12 16:26 GMT+02:00 Andrew Lowe <agl@wht.com.au >>>>> <mailto:agl@wht.com.au>>: >>>>> >>>>> Hi all, >>>>> A bit off topic here, but there are plenty of people who >>>>> seem to know their shells back to front so here goes. [snip] ... ... [snip] > > A better function for the same (that also doesn't loop forever because > the function might be calling itself): > > npp() { > command npp "$@" & > } > > This allows any number of arguments to be passed, instead of "exactly > one" and allows filenames containing spaces, etc. to be passed correctly. > Thanks, that's a nice little tweak. Andrew ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] [A bit off-topic] Bash alias and & 2016-06-12 15:07 ` Andrew Lowe 2016-06-12 15:54 ` [SOLVED]Re: " Andrew Lowe @ 2016-06-12 17:04 ` Peter Humphrey 2016-06-12 18:07 ` Mick 1 sibling, 1 reply; 12+ messages in thread From: Peter Humphrey @ 2016-06-12 17:04 UTC (permalink / raw To: gentoo-user Oi! I'm missing e-mails! On Sunday 12 Jun 2016 23:07:09 Andrew Lowe wrote: > On 06/12/16 22:43, Alan McKinnon wrote: I haven't received Alan's e-mail. > > On 12/06/2016 16:33, Nico Verrijdt wrote: > >> Hi Andrew, > >> > >> 2016-06-12 16:26 GMT+02:00 Andrew Lowe <agl@wht.com.au > >> > >> <mailto:agl@wht.com.au>>: > >> Hi all, > >> > >> A bit off topic here, but there are plenty of people who > >> > >> seem to know their shells back to front so here goes. > >> > >> I have set up a Win32 based development environment, > >> > >> bash/cc/ls/etc/etc, for 1st year Engineering students who have to > >> learn C on a command line. It's fine for me to remember to put the > >> & > >> at the end of the command when I fire up the editor but for them, > >> it's major angst. > >> > >> The first thing that comes to mind is an alias. Just off > >> > >> the top of my head I tried: > >> alias "npp=npp %1 &" > >> > >> Shouldn't this be: alias npp="npp %1 &" ? > >> > >> npp being the editor, but that didn't work. Is an alias the > >> best/easiest way to do this and if so, what would the syntax be, or > >> is there a better way? > >> > >> Any thoughts, greatly appreciated, > >> > >> Andrew > >> > >> Hope this helps, > >> Nico > > > > Or just tell them to remember to add the & at the end. > > With an alias what will they do when they don't want it? > > > > Or look at it this way: > > > > It's syntax, it's important. C is probably more syntax-critical than any > > other language around (binds to the right, anyone?) so what's the > > problem with requiring correct syntax on the command line as well? > > > > Obligatory disclaimer: I've recently had a bellyache full of dumb people > > who insist I put code when a human (themselves) belongs... > > Yes, I agree BUT, this is a "half subject" in a common first year of an > Engineering degree. These are people who will become > Civil/Mechanical/Electrical/Chemical Engineers and they have no desire > to learn programming. To put it bluntly, all they are interested in is > their car, getting drunk and trying to get a root - the order may vary, > but that is the top three priorities. Anything else is just too much to > think about. > > In reality, I'm doing this to make my life easier. As much as I tell > them to do something, write up documents that tell them what to do and > reiterate what they have to do, I still get the question "It's broken, > it won't do as I want...." > > Andrew > > p.s. Nico's point was a typo on my part in the email. Now that's a classic debug case - where are these messages being dropped? It's the second time I've noticed it in this list today. -- Rgds Peter ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] [A bit off-topic] Bash alias and & 2016-06-12 17:04 ` [gentoo-user] " Peter Humphrey @ 2016-06-12 18:07 ` Mick 2016-06-13 8:56 ` Peter Humphrey 0 siblings, 1 reply; 12+ messages in thread From: Mick @ 2016-06-12 18:07 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: text/plain, Size: 766 bytes --] On Sunday 12 Jun 2016 18:04:39 Peter Humphrey wrote: > Oi! I'm missing e-mails! I occasionally miss the odd email here and there too. Sometimes I find (only some of) them in Gmail's Spam folder. Other messages totally disappear and I surmise I missed parts of a thread by subsequent messages in the list, which I receive as expected. Tis a mystery! O_o [snip ...] > Now that's a classic debug case - where are these messages being dropped? > > It's the second time I've noticed it in this list today. Gmail is more reliable than other mail ISPs I have used over the years and it is free (at the point of use), so I live with it. I don't know if missing messages are caused by Gmail, or by gentoo's M/L smtp server. -- Regards, Mick [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] [A bit off-topic] Bash alias and & 2016-06-12 18:07 ` Mick @ 2016-06-13 8:56 ` Peter Humphrey 0 siblings, 0 replies; 12+ messages in thread From: Peter Humphrey @ 2016-06-13 8:56 UTC (permalink / raw To: gentoo-user On Sunday 12 Jun 2016 19:07:45 Mick wrote: > On Sunday 12 Jun 2016 18:04:39 Peter Humphrey wrote: > > Oi! I'm missing e-mails! > > I occasionally miss the odd email here and there too. Sometimes I find > (only some of) them in Gmail's Spam folder. Other messages totally > disappear and I surmise I missed parts of a thread by subsequent messages > in the list, which I receive as expected. Tis a mystery! O_o --->8 > Gmail is more reliable than other mail ISPs I have used over the years and > it is free (at the point of use), so I live with it. I don't know if > missing messages are caused by Gmail, or by gentoo's M/L smtp server. Well I don't use GMail, so that rules that out. Oh, and I'm also subscribed to kdepim-users@kde.org, which (also?) uses mailman. I see hardly any traffic there but occasionally a message comes through showing that I've missed lots of others. Even if I post there myself I don't see my message. -- Rgds Peter ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] [A bit off-topic] Bash alias and & 2016-06-12 14:26 [gentoo-user] [A bit off-topic] Bash alias and & Andrew Lowe 2016-06-12 14:33 ` Nico Verrijdt @ 2016-06-13 9:49 ` Joerg Schilling 2016-06-14 5:04 ` Adam Carter 1 sibling, 1 reply; 12+ messages in thread From: Joerg Schilling @ 2016-06-13 9:49 UTC (permalink / raw To: gentoo-user Andrew Lowe <agl@wht.com.au> wrote: > The first thing that comes to mind is an alias. Just off the top of my > head I tried: > > alias "npp=npp %1 &" > > npp being the editor, but that didn't work. Is an alias the best/easiest > way to do this and if so, what would the syntax be, or is there a better > way? Looks like something that will not work as %1 is not understood except by the jobcontrol commands. It may be an attempt to write a parameterizable alias.... AFAIK, bash does not support parameterized macros. Jörg -- EMail:joerg@schily.net (home) Jörg Schilling D-13353 Berlin joerg.schilling@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.org/private/ http://sourceforge.net/projects/schilytools/files/' ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-user] [A bit off-topic] Bash alias and & 2016-06-13 9:49 ` Joerg Schilling @ 2016-06-14 5:04 ` Adam Carter 0 siblings, 0 replies; 12+ messages in thread From: Adam Carter @ 2016-06-14 5:04 UTC (permalink / raw To: gentoo-user@lists.gentoo.org [-- Attachment #1: Type: text/plain, Size: 238 bytes --] Another option is to suspend the foreground process (ctrl-Z) then you can background it by typing bg, which will resume running and put it in the background. # sleep 10 ^Z [1]+ Stopped sleep 10 m # bg [1]+ sleep 10 & # [-- Attachment #2: Type: text/html, Size: 312 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2016-06-14 5:04 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-06-12 14:26 [gentoo-user] [A bit off-topic] Bash alias and & Andrew Lowe 2016-06-12 14:33 ` Nico Verrijdt 2016-06-12 14:43 ` Alan McKinnon 2016-06-12 15:07 ` Andrew Lowe 2016-06-12 15:54 ` [SOLVED]Re: " Andrew Lowe 2016-06-12 19:06 ` [gentoo-user] Re: [SOLVED]Re: " Jonathan Callen 2016-06-13 6:59 ` [gentoo-user] " Andrew Lowe 2016-06-12 17:04 ` [gentoo-user] " Peter Humphrey 2016-06-12 18:07 ` Mick 2016-06-13 8:56 ` Peter Humphrey 2016-06-13 9:49 ` Joerg Schilling 2016-06-14 5:04 ` Adam Carter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox