I would put forward though that leaving out the default action {print $0} is no more a short-cut than leaving out the default condition 1, and also print prints the default value, which is $0 (and the semicolons are unnecessary). So in full it would be..
Which can of course be combined into 1 block, since the condition is the same (like agama did in post #2)..
I sometimes have a preference for one-liners because I think they are sometimes easier to read (but only if they are short, true one-liners (fewer than 65 characters), and they are great for cutting and pasting or just composing on the command line..
Last edited by Scrutinizer; 07-28-2012 at 06:17 PM..
Hi all
I have tried to search for this, but keep getting a MySQL db connect error, so am posing the question here, and taking a risk of incurring the wrath of the mods with my first post...
I have the following test script:
#!/bin/bash
HTTPD=`/bin/ps -axcu | /usr/bin/grep httpd... (6 Replies)
Hi Guys,
could someone tell me what this ksh construct does
typeset -r PROG_PWD=${0%/*} does
I understand the -r for readonly but I would very much appreciate a definitive account of what this will set $PROG_PWD to.
If I run this at the cmd line it it gets set to /usr/bin but I would... (2 Replies)
I was checking my error logs today and ran into some errors I have not seen before maybe somebody has run into these before?
/etc/cron.quarter-hourly/owusers.sh:
Set effective gid to mail(12) failed!
/usr/local/mailwatch/check_sendmail_relay.sh: line 8:
thanks (1 Reply)
Hi all,
Sorry to ask this easy question but I am stuck. In a scenario i am executing one shell script which contains a if - else construct :
if ; then
echo $line
$line >> successful_build.txt
else
$line >> failed_services.txt
fi
explaination : if the... (5 Replies)
I recently was handed responsibility for a script which has array references that are new to me and I could use some help understanding them.
Parts of the config file and script are included. This script collects backups from a jail server of the jails running on that host. Several jail... (1 Reply)
Hi all
i have been trying to do a small 'question and answer' script using if-else statement and a combination of pipe. I have succeeded in allowing the user to login with user name and password stored in a sequence username/password in a file named "pass" like this:
echo "please enter your... (14 Replies)
Hi,
I need to construct the below path from the two available directory path,
O/P
/home/data/test/run/ht/WEB/HTML
/home/data/test/run/ht/WEB/JSP
/home/data/test/run/ht/WEB/CSS
Path:1
------
/home/data/test/run/
Path:2
------
/home/data/share/app/01/lang/ht/WEB/HTML... (5 Replies)
Hi all,
I thought this would be simple, but I've been having a lot of trouble trying to write this IF statement, if I may ask for help pls:
In BASH, how would I construct the if statement:
Should ONLY be true if USEROPTscript=="yes"]] AND $mode=="INSTALL" /or/ $mode=="CHANGE" ]]... (3 Replies)
Discussion started by: jmccoughlin
3 Replies
LEARN ABOUT DEBIAN
pdl2
PDL2(1p) User Contributed Perl Documentation PDL2(1p)NAME
pdl2 - Simple shell (version 2) for PDL
SYNOPSIS
Use PDL interactively:
%> pdl2
pdl> $a = sequence(10) # or any other perl or PDL command
pdl> print "$a = $a
";
$a = [0 1 2 3 4 5 6 7 8 9]
DESCRIPTION
The "pdl2" program, also known as the Perldl2 shell, is a second generation version of the original "perldl" interactive PDL shell. It
attempts to be backward compatible in usage while providing improved features, better support for Perl syntax, and an more easily extended
framework based on the Devel::REPL shell.
If you have Devel::REPL version 1.003011 or later, then "pdl2" will start with full functionality. If Devel::REPL is not installed or
found then "pdl2" will print a warning and run the legacy "perldl" shell command instead.
By default, command lines beginning with the default prompt of either "pdl2" or "perldl" (one of 'pdl> ', 'PDL> ', or 'perldl> ') will have
the prefix string and surrounding whitespace stripped. This allows for easy cut-and-paste from sample PDL shell sessions or other examples
into another PDL shell session.
FUNCTIONS
do_print
Toggle print-by-default on and off (default value: off)
By default, "pdl2" does not print the results of operations since the results can be very large (e.g., a small 640x480 RGBA image is still
more than 1_000_000 elements). However, for experimenting and debugging more complex structures, it helps to see the results of every
operation. The "do_print" routine allows you to toggle between the default "quiet" operation and a full Read, Evaluate, Loop style.
pdl> $a = pdl(3,2)
pdl> do_print
1
pdl> $a = pdl(3,2)
$PDL1 = [3 2];
pdl> do_print
pdl> $a = pdl(3,2)
VARIABLES
$PDL::toolongtoprint
The maximal size pdls to print (defaults to 10000 elements). This is not just a "perldl" or "pdl2" variable but it is something that
is usually needed in an interactive debugging session.
SEE ALSO
perldl, Devel::REPL
perl v5.14.2 2012-05-19 PDL2(1p)