Sponsored Content
Top Forums Shell Programming and Scripting [SOLVED] Capturing output in a korn variable Post 302640999 by Corona688 on Tuesday 15th of May 2012 01:54:58 PM
Old 05-15-2012
You need to give it the -- option to tell it that negative numbers should be taken literally instead of being considered commandline arguments.
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

capturing the output of grep as integer variable

Hi, I have an expression using grep and nawk that captures the ID number of a given Unix process. It gets printed to screen but I don't know how to declare a variable to this returned value! For example, ps -ef|grep $project | grep -v grep | nawk '{print $2}' This returns my number. How... (2 Replies)
Discussion started by: babariba
2 Replies

2. Shell Programming and Scripting

Losing new lines when capturing output to variable

Explain this? $ ls | grep -e "crd\|cs" crd cs $ CLONES=`ls | grep -e "crd\|cs"`;echo $CLONES; crd cs $ CLONES=`ls | grep -e "crd\|cs"`;echo "$CLONES"; crd cs (1 Reply)
Discussion started by: blasto333
1 Replies

3. Shell Programming and Scripting

capturing output from top and format output

Hi all, I'd like to capture the output from the 'top' command to monitor my CPU and Mem utilisation.Currently my command isecho date `top -b -n1 | grep -e Cpu -e Mem` I get the output in 3 separate lines.Tue Feb 24 15:00:03 Cpu(s): 3.4% us, 8.5% sy .. .. Mem: 1011480k total, 226928k used, ....... (4 Replies)
Discussion started by: new2ss
4 Replies

4. Shell Programming and Scripting

Capturing output of procedure in variable in shell script

Hi guys I am calling one DB2 stored proc through unix. It is giving me below output. I want to capture the value 150 in one UNIX variable in shell script. Please let me know how I can achieve this. Thanks in advance Value of output parameters -------------------------- Parameter Name :... (5 Replies)
Discussion started by: vnimavat
5 Replies

5. Shell Programming and Scripting

[Solved] Output in bash script not captured in variable

I'm tring to write down a simple script that would execute a command and wait until it returns a specific result. This is what i did: bjobs_out=`bjobs` while ]; do bjobs_out=`bjobs` sleep 6 done It seems to work until the command 'jobs' return the list of jobs in execution, but... (4 Replies)
Discussion started by: lifedj
4 Replies

6. UNIX for Dummies Questions & Answers

Solved: how to save an output to a variable

i want to save the output of /scripts/whoowns domain.com to a username like $user = /scripts/whoowns domain.com but I'm not sure how to do that This is inside a bash script how can I get the output of /scripts/whoowns then save that to a variable? thanks! ---------- Post updated at... (0 Replies)
Discussion started by: vanessafan99
0 Replies

7. UNIX for Dummies Questions & Answers

[solved]Korn, disabling * substitution

If I execute the following line of code: echo "*" I get a list of files in the current directory. What if all I wanted to do was display the asterisk itself? What does the code have to look like so all I get is an asterisk? Thanks ahead of time for your assistance ----------... (3 Replies)
Discussion started by: Wreckoning
3 Replies

8. Shell Programming and Scripting

Capturing Output?

Hello All, I'm writing a Bash Script and in it I execute a piped command within a Function I wrote and I can't seem to redirect the stderr from the 1st pipe to stdout..? I'm setting the output to an Array "COMMAND_OUTPUT" and splitting on newlines using this --> "( $(...) )". By putting... (6 Replies)
Discussion started by: mrm5102
6 Replies

9. Shell Programming and Scripting

[Solved] Issue with using for loop as for in {2..6} in korn shell

Hi i have to cut columns 2 to 6 from a file and assign it to arrays , The following code works for ctcol in 2 3 4 5 6; do set -A a$ctcol $(cut -d, -f $ctcol test_file) done how ever this does not work for ctcol in {2..6}; do set -A a$ctcol $(cut -d, -f $ctcol test_file)... (4 Replies)
Discussion started by: 100bees
4 Replies

10. UNIX for Dummies Questions & Answers

[Solved] Korn Shell execution

There are two Korn Shell scripts : script_1.ksh ( located in /home/dir1 ) script_2.ksh ( located in /home/dir2 ) Content of script_2.ksh is #!/usr/bin/ksh echo "Hello world.." The script_2.ksh is called from within script_1.ksh using the following command : ./home/dir2/script_2.ksh but... (7 Replies)
Discussion started by: kumarjt
7 Replies
cow-shell(1)							     cowdancer							      cow-shell(1)

NAME
cow-shell - Start a copy-on-write session and invoke a shell. SYNOPSIS
cow-shell [commandline] DESCRIPTION
cow-shell Executes specified command with cowdancer or a shell if no command-line option is given. Inside the cowdancer session, files under the current directory are protected in a way so that a write operation to an i-node which existed at the point of running cow-shell is not modified. Useful for managing hard-linked source-trees and scratch-filesystems. EXAMPLES
cp -al cowdancer/ cowdancer.new && cd cowdancer.new && cow-shell Create a hardlinked tree, and cd into the newly created tree. After invoking cow-shell inside that tree, a write operation against a file that is hardlinked with the original tree will be copied to a new file before write. cp -al cowdancer/ cowdancer.new && cd cowdancer.new && cow-shell debuild Tries to run dpkg-buildpackage on the new tree, to avoid damage to the original tree. Configure debuild to ignore .ilist files, through -i or -I option. FILES
.ilist Generated dynamically in the current directory. The file contains the list of i-node numbers that should be protected from write operation. /usr/lib/cowdancer/libcowdancer.so The shared library used internally that overrides some functions that potentially write to files. This library implements the COW feature and is preloaded with LD_PRELOAD. /bin/cp Used for copying. Requires GNU option -a to be functional. ENVIRONMENT
COWDANCER_ILISTFILE The path to the current .ilist file. COWDANCER_IGNORE Used internally to work around infinite loops. It will be unset. LD_PRELOAD Utilized to preload libcowdancer.so COWDANCER_DEBUG Debugging option. Enables debug messages. cowdancer will give verbose debug messages in standard error output. COWDANCER_SO Debugging option. Specifies a different path for libcowdancer.so. COWDANCER_REUSE=yes Enables reuse of cowdancer .ilist file found for consecutive runs of cow-shell. RETURN VALUE
The functions that are overridden with cowdancer will give an errno value of ENOMEM when there is a problem. System isn't really out of memory, but this error code is chosen because this error is usually handled gracefully by applications. RESTRICTIONS
Can only support directories that are scanned by cow-shell command. The operation is not semantically correct when files are originally hardlinked, hardlinks are always broken. Does not support anything when LD_PRELOAD trick does not work. Does not work unless hardlinks are supported on the filesystem. Not very user-friendly. Leaves .ilist file around. AUTHOR
Junichi Uekawa (dancer@debian.org) Upstream page is available at http://www.netfort.gr.jp/~dancer/software/cowdancer.html SEE ALSO
cowdancer-ilistcreate (1) cowdancer 2006 Jan 25 cow-shell(1)
All times are GMT -4. The time now is 10:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy