PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Variable in embedded perl script
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Variable in embedded perl script

Réponse
 
LinkBack Outils de la discussion
Vieux 30/05/2007, 07h49   #1
Jose Luis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Variable in embedded perl script


Hi,

In the ksh script below:

#!/usr/bin/ksh

perl <<-EOF
my \$var="hello world\n";
print "\$var";
EOF



I need to put the "\" character before all vars in the perl script.
How can I avoid it?

Thanks in advance,
Jose Luis

  Réponse avec citation
Vieux 30/05/2007, 08h16   #2
Stachu 'Dozzie' K.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Variable in embedded perl script

On 30.05.2007, Jose Luis <jose.luis.fdez.diaz@gmail.com> wrote:
> In the ksh script below:
>
> #!/usr/bin/ksh
>
> perl <<-EOF
> my \$var="hello world\n";
> print "\$var";
> EOF
>
>
>
> I need to put the "\" character before all vars in the perl script.
> How can I avoid it?


`man perlrun', option -e

--
Secunia non olet.
Stanislaw Klekot
  Réponse avec citation
Vieux 30/05/2007, 10h52   #3
Barry Margolin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Variable in embedded perl script

In article <1180507741.259940.164980@q69g2000hsb.googlegroups .com>,
Jose Luis <jose.luis.fdez.diaz@gmail.com> wrote:

> Hi,
>
> In the ksh script below:
>
> #!/usr/bin/ksh
>
> perl <<-EOF
> my \$var="hello world\n";
> print "\$var";
> EOF
>
>
>
> I need to put the "\" character before all vars in the perl script.
> How can I avoid it?


perl <<-'EOF'
my $var="hello world\n";
print "$var";
EOF

Putting single quotes around the here-document delimiter tells the shell
not to perform any expansion on the contents of the here-document.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h19.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08968 seconds with 11 queries