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 <a...@wht.com.au
<mailto:a...@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



Reply via email to