« first day (456 days earlier)      last day (2582 days later) » 

3:50 AM
@Queen k
@Queen k
 
 
3 hours later…
7:44 AM
@Queen k
 
@Queen k though not really a question
 
tripleee in bash scanned 1004 questions between Jul 15 02:16 and Mar 22 08:52 filtered and ordered: 20 in batch 6
 
ghod that's annoying
 
8:09 AM
@Queen done
 
@Queen k
 
 
2 hours later…
10:17 AM
What is .pl extension used for? Anyone
 
generally perl scripts
 
Is it same as shell script?
 
but file extension on unix systems is just indicative ... not mandatory.
Perl is an interpreted scripting language it's not a shell
 
Okay
 
but you can execute perl scripts much like shell scripts ... as long as the interpreter is defined correctly .... else you need to explicit the interpreter in the command line
 
10:24 AM
So i can change the extension from .pl to .sh and execute the script?
 
no .... the interpreter must match the language used in the script .... and perl in not compatible with shell
but some shells are partialy compatible ... like bash scripts may partially work on ksh and vice versa
provided you don't use associative arrays or other incompatible syntax stuff
 
can i share the code?
I really didnt understand it clearly
 
I'm no good with perl .... but you can try ... maybe if I can't help some of the others can ....
it looks like being off topic on this chat ... but try politely ... you might get an answer.
there might be a perl specific chat room
 
Okay, I was under a wrong impression. I thought it was part of bash script
 
look at the first line of the script
if it is something like
#!/usr/bin/perl
it's a perl script
 
10:33 AM
Okay
 
if it's something like
#!/bin/bash
it's a bash script
 
Okay got that
 
#!<interpreter>
in general
 
Okay
This is the code
my $sum=0;
while (<STDIN>) {
my $line = $_;
chomp($line);
$sum=${sum}+${line};
}
print $sum;
 
you can have a bash script named hello.pl if your really want
as the file extension is only indicative on unix
no interpreter so you need to specify it on the command line when you execute it
it's not a bas script
 
10:38 AM
So i wont be able to execute the script on bash shell right?
 
supposing it's perl (and I'm not sure on that)
you can execute it from the shell prompt like this:
perl script_name.pl
you need perl to be installed on your system
 
Okay Thankyou. Let me try installing Pearl
 
11:28 AM
that's p-e-r-l not p-e-a-r-l
@louigi600 sure that's run of the mill Perl
though not very idiomatic, it could be a one-liner
perl -nle '$sum += $_ END { print $sum }'
@BasilPaul the shell basically allows you to run a script in any language as long as it has a valid shebang line; so a script that starts with #!/usr/bin/perl can be run from Bash as long as you have /usr/bin/perl on your system
 
 
1 hour later…
12:55 PM
^ ouch, missing some semicolons etc, sorry
 
:P
why do you call the specification of the interpreter shebang ?
or did you mean something else that I'm not understanding ?
 
1:11 PM
@louigi600 that's what it's called. en.wikipedia.org/wiki/Shebang_(Unix)
that's arguably jargon but jargon is useful so you don't have to explain things which are widely understood
 
@Queen k
 
 
1 hour later…
@Queen k
 
3:01 PM
@tripleee the man page does not refer to it as shebang ... or I could not find it :D
 
@louigi600 the man page would not usually use jargon
 
there should be a j section to the man pages with jargon in there :D
 
3:13 PM
or a google search box
 
 
3 hours later…

« first day (456 days earlier)      last day (2582 days later) »