[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] (#!)^2 problem



Carsten Svaneborg <sslug@sslug> writes:

> Jeg forsøger at bruge et (perl) script som interpreter
> for et andet script, hvilket giver mig ged.

Jeg er ikke helt sikker på at jeg forstår præcis hvad du mener. Men
betragt følgende:

plugh% cat > plaf
#!/usr/bin/perl -l
print $_ for (@ARGV);
plugh% chmod a+x ./plaf
plugh% /tmp/plaf foo bar baz
foo
bar
baz
plugh% cat > test.plaf
#!/tmp/plaf foo bar baz
pling 
plang
plong
plugh% chmod a+x ./test.plaf
plugh% ./test.plaf      
foo bar baz
./test.plaf
plugh% 

/tmp/plaf kaldes altså med *to* argumenter. Dels det der forekommer på
shebang-linjen og dels navnet på det script /tmp/plaf skal 'fortolke'.
Det mener jeg også er hvad man kunne forvente

Man kan vist ikke altid regne med at man kan overføre argumenter på
shebang-linjen, så hvis ens script skal virke portabelt skal man vist
være klar til selv at fortolke shebang-linjen efterfølgende. 

> Jeg ville forvente at få 1 2 3 test.sk

Men du bør forvente at få enten:

1
2
3
test.sk

eller som jeg får:

1 2 3
test.sk

Desvære skriver du ikke hvad du rent faktisk får, så jeg har ingen
mulighed for at sige hvad dit problem skykdes. 

> Nogen måde at komme uden om det problem på, uden at lave
> pxmg til et ikke-shell program?

'ikke-shell program'? Men pxmg er ikke et shell-program. Det er jo
skrevet i perl.

-- 
 Peter Makholm     |                The four letter word beginning with L?
 sslug@sslug |                It's life, love, libc or lisp         
 http://hacking.dk |                    --  Depending on you point of view


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 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] *