Re: Can $1 be set in a script?



larryalk <nobody@xxxxxxxxxxx> wrote:
On Fri, 31 Mar 2006 01:35:57 -0500, Bill Marcum <bmarcum@xxxxxxxxx>
wrote:

something=${1:-"default string"}

Excellent point.

Bill I ran across this exact same construction before in connection
with an ~/.xinitrc script.

Would you please tell me what the syntax means of:
(1:-"default string")

It does exactly the same thing that the several lines of my code
did.

I _guess_ it represents a variable.
What does the colon and minus sign signify?

Why guess... you should read the man page for bash...

Start by reading the section titled "Parameter Expansion".

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@xxxxxxxxxx
.



Relevant Pages

  • Re: About Tcl syntax...
    ... Adrian Davis wrote: ... anything may be used in a script by somebody somewhere. ... this cycle when doing what became the {*}expansion syntax. ...
    (comp.lang.tcl)
  • Re: function definition syntax
    ... :> In which case it might as well be a separate script - you don't need a function. ... :>: That's much more reliable than having to remember which syntax ... Always using POSIX ... :> not overlook restoring IFS. ...
    (comp.unix.shell)
  • Re: Books/References new to scripting in AD/2003
    ... my own website has lots of script samples you might find useful: ... test bits of flag attributes like userAccountControl using SQL syntax. ... To restrict the query to an OU, ...
    (microsoft.public.windows.server.scripting)
  • Re: Books/References new to scripting in AD/2003
    ... Good luck with your scripting - It's a worthwhile pursuit and the time you spend learning to script can easily be re-paid. ... I don't believe there is any way to test bits of flag attributes like userAccountControl using SQL syntax. ... but needs to be enclosed in quotes in a query. ...
    (microsoft.public.windows.server.scripting)
  • Re: Legacy code/browser compatibility
    ... a user of such an ancient browsers may see a syntax error ... either script supported or not. ... browsers, script will be supported. ... that doesn't support object literals ...
    (comp.lang.javascript)