[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] bash-script og parametre med wildcard



Peter Makholm <sslug@sslug> writes:

> Men du kan bruge alle argumenterne ved at bruge "$@" (*med*
> dobbelt-plinger):
>
>         #!/bin/sh
>         jhead "$*"

Ehmmm, "$@" er korrekt, "$*" er forkert. Altså:

         #!/bin/sh
         jhead "$@"

Forskellen er at "$@" vil konstruerer hvert enkelt argument som
selvstændigt argument til jhead, mens "$*" vil konstruerer ét argument
bestående af alle argumenterne adskilt af mellemrumstegn.

> Men som sagt kan du med "$*" i dit script få fat på alle di navne som
> '*.jpg' folder ud til. Men husk dobbelt-plingerne omkring, ellers går
> det galt hvis du har argumenter med mellemrumstegn i.

Og her skulle der så også stå "$@".

-- 
 Peter Makholm     |                                              What if:
 sslug@sslug |                Tanenbaum had convinced Linus that his
 http://hacking.dk |                  operating system really was obsolete


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-04-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *