I'm trying to set a variable to the output of a command.
This is what the comand output to the display looks like:
When I set my variable equal to the results of this command all the NL in the output are apparently lost. I want to preserve the output in my variable exactly as it is displayed on the screen so that I can ECHO it later and it looks correct.
Is there a way to tell Unix Ksh to preserve the NL when assigning command output to a variable?
I'm new to unix scripting. How would I go about pulling the first 3 characters from a variable in ksh and storing in another variable? Thanks. (9 Replies)
With C Shell you can get the root, head, tail and extension of a pathname by using pathname variable modifiers.
Example Script:
#! /bin/csh
set pathvar=/home/WSJ091305.txt
echo $pathvar:r
echo $pathvar:h
echo $pathvar:t
echo $pathvar:e
The result of executing this script is:
... (7 Replies)
Hey all,
I have been using Ksh and in that I am setting Environment variables.
To set Env. Variables I have created my own file "BuildScript.sh" in which i have written :
export CLASSPATH=/somedir/some other dir/file:.
export PATH=/some dir/file:.
But when i am calling this... (4 Replies)
hi all,
how do i subract variables in shell ?? am trying to space out the headers and the output generated by the shell so they all line up :
currently the output is like this :
servers : users
server1 : 10
latestServer : 50
so i thought... (3 Replies)
I can't believe I can't figure this out... given this code:
CARS_DATA_LIST=`cat /tmp/file1 | awk '{print $1}' `
FMSA_DATA_LIST=`cat /tmp/file2 | awk '{print $1}' `
The value of each of the above variables is:
CARS = a b c d e f g
FMSA = a b c q r s
I want to declare a third... (8 Replies)
I have these
str1=$(echo "This is string one with spaces \n This is also my sentence 1")
When I echo $str1, it displays the new line character properly.
Now I have another new variable say str2.
I want to concatenate in this way.. str1 + newline character + and then str2.
That's I... (3 Replies)
Hi,
I 'm trying to send an e-mail for every different line in the .txt
for i in {1..$variable}
do
sed -n "/$i$/p" text.txt
done
I have two problems about this.
First one is that for loop doesn't work
and the second one is that i cant get the output of sed (4 Replies)
Cannot combine these two strings into one line, either as a 3rd variable or echo or printing ? Frustrating.
for i in `cat /scripts/pathList.dat`
do
OldRepo= grep Oldhostname ${i}/.svn/entries | tail -1
NewRepo= grep Oldhostname ${i}/.svn/entries | tail -1 | sed '/Oldhostname/... (41 Replies)
Hi Friends ,
I want to know how to format the output for the following:
i searched in the forum and couldnt get the exact requirement.
Thanks in advance . (2 Replies)
Hi. I'm getting the following hidden characters \uat the start of a string after I pass in variables from the command line. I only noticed this when I set -x in my KSH script. Can anybody tell me how this happens and how to remove them?
Many thanks.
+ STR=$'\uusername testuser1'
+ print... (12 Replies)
Discussion started by: user052009
12 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)