Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Need to pass variable in a command and assign value to a variable Post 302999725 by RudiC on Tuesday 27th of June 2017 03:13:43 AM
Old 06-27-2017
- execute the command on its own
- set the xtrace option (set -vx)
and post the results.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

assign awk command result to a variable

#!/bin/sh # ## MYSTRING = `awk '/myApp.app/' /Users/$USER/Library/Preferences/loginwindow.plist` if then echo String not found defaults write /Users/$USER/Library/Preferences/loginwindow AutoLaunchedApplicationDictionary -dict-add -string Hide -bool YES -string Path -string... (9 Replies)
Discussion started by: dedmakar
9 Replies

2. Shell Programming and Scripting

Assign bash command to variable

Hi I am trying to write a function that needs to be able to assign the last run shell command to a variable. The actual command string itself not the exit code of the command. I am using the bash command recall ability to do this as follows: alias pb='ps | grep ash' ... (3 Replies)
Discussion started by: Moxy
3 Replies

3. UNIX for Dummies Questions & Answers

Cut Command value assign to variable

Hi, I am new to UNIX Scripting. I have been trying to use the CUT command to retrieve part of the header from a file and assign it to a variable. I have tried searching a lot, but I am still unsuccessful. Sample Header: HJAN BALANCE 20090616 I need to retrieve the date here, which always... (10 Replies)
Discussion started by: ragz_82
10 Replies

4. Shell Programming and Scripting

Assign command (with pipe) output to a variable

Hi , I would like to assign command (with pipe) output to a variable. The code is as follows. The goal of the code is to get the last folder folder with a particular name pattern. myDate=`ls | grep 2009 | tail -1` echo "myDate=" $myDate However, in the presence of the pipe, the code... (3 Replies)
Discussion started by: jeff_cen
3 Replies

5. Shell Programming and Scripting

assign awk's variable to shell script's variable?

Dear All, we have a command output which looks like : Total 200 queues in 30000 Kbytes and we're going to get "200" and "30000" for further process. currently, i'm using : numA=echo $OUTPUT | awk '{print $2}' numB=echo $OUTPUT | awk '{print $5}' my question is : can I use just one... (4 Replies)
Discussion started by: tiger2000
4 Replies

6. Red Hat

How to pass value of pwd as variable in SED to replace variable in a script file

Hi all, Hereby wish to have your advise for below: Main concept is I intend to get current directory of my script file. This script file will be copied to /etc/init.d. A string in this copy will be replaced with current directory value. Below is original script file: ... (6 Replies)
Discussion started by: cielle
6 Replies

7. Shell Programming and Scripting

Unable to assign command output to variable

Code set -x STATUS="0" echo $STATUS for i in `ls -ltr Report*|awk '{ print $9 }'` do if then flg = "`head -1 "$i" |cut -c 31-33`" echo `head -1 "$i" |cut -c 31-33` echo $flg if then echo "having Fun" STATUS="2" else echo "no Fun" fi fi (2 Replies)
Discussion started by: Funkeydude
2 Replies

8. Shell Programming and Scripting

Assign the result of a multiline command to a variable

Hi, I have the following command that lists all the .o files from all the directories except of vwin (which I don't want it) for i in `ls -d */*.o|awk '$0 !~ "vwin"'`; do echo $i; done The result is something like that dir1/file1.o dir1/file2.o dir2/file3.o etc. So, I want to create a... (9 Replies)
Discussion started by: scor6800
9 Replies

9. UNIX for Beginners Questions & Answers

How can I assign awk's variable to shell script's variable?

I have the following script, and I want to assign the output ($10 and $5) from awk to N and L: grdinfo data.grd | awk '{print $10,$5}'| read N L output from gridinfo data.grd is: data.grd 50 100 41 82 -2796 6944 0.016 0.016 3001 2461. where N and L is suppose to be 3001 and 100. I use... (8 Replies)
Discussion started by: geomarine
8 Replies

10. UNIX for Beginners Questions & Answers

Assign a command to a variable - Help

Hi, I have the script below. When i assign SSH_COMMAND to "ssh -o ConnectTimeout=2 ${SERVER} ${AS_SUDO} ${COMMANDS}" and then execute it as ${SSH_COMMAND} I get the following error: ssh: Could not resolve hostname sudo: Name or service not known ssh: Could not resolve hostname sudo: Name or... (3 Replies)
Discussion started by: mohca2020
3 Replies
XTRACE(1)							      XTRACE								 XTRACE(1)

NAME
xtrace - trace communication between X11 client and server SYNOPSIS
xtrace [ options ] [ -s | -k ] [ [ -W ] [ -- ] command args ... ] DESCRIPTION
Xtrace fakes an X server and forwards all connections to a real X server, displaying the communication between clients in (well, theoreti- cally) human readable form. If a command is given, xtrace executes the named command with $DISPLAY set to the faked X server. If that com- mand exits before any connections are made, xtrace exits immediately unless -W is specified. OPTIONS
-I directory Look into directory for protocol description files. (i.e. the directory where the .proto files can be found). -s | --stopwhendone (default) Terminate when all forwarded clients have disconnected. (Or when a program was run once the program has finished and all connec- tions are closed). -k | --keeprunning If all clients disconnected, wait for new ones to connect. -W | --waitforclient Do not stop when the started program terminates before any connection was made. (Might be necessary if the program forks to back- ground). -d name | --display name Forward connections to the X server specified by name instead of the one specified by the environment variable DISPLAY. -D name | --fakedisplay name Fake display name instead of $FAKEDISPLAY or :9 respectively. -f filename | --authfile filename Add an -f filename to the arguments for all calls to xauth to get the authentication tokens of the X server to connect to. -F filename | --newauthfile filename Add an -f filename to the arguments for all calls to xauth to save the authentication tokens to connect to the faked X server. -c | --copyauthentication (default) Copy the authentication tokens for the X server to connect to so that clients connecting to our fake server will use them. The commands run are roughly equivalent to: xauth add $FAKEDISPLAY . `xauth list $DISPLAY | awk '$2=="MIT-MAGIC-COOKIE-1" {print $3}'` Not that only MIT-MAGIC-COOKIE-1 tokens are copied as xtrace does not yet support to change the authentication tokens so that XDM- AUTHORIZATION-1 would be possible. -n | --nocopyauthentication Do not call xauth and do fiddle with authentication tokens but leave that to the user to handle. -e | --denyextensions Modify all server replies to say there are no extensions available. (As xtrace does supports only a small number of extensions any- way and calls all extended requests "unknown" and all replies to such requests "unexpected"). -w | --readwritedebug Print how many bytes are read and/or written when. -m count | --maxklistlength count Print only the first count many elements of all lists. -i | --interactive Only sent requests from the client to the server after interactive confirmation. Confirmation is given by pressing enter or a num- ber followed by enter via stdin. This can give funny results when multiple clients are tunneled. -o | --outfile filename Dump output into filename instead of stdout. -b | --buffered Do not write every line on its own but wait until buffers are full. Speeds up things a little bit when outputting to a file. Not very useful at all together with -i. --timestamps Print a timestamp before each line. Note that the time a packet is printed is between the time a packet is received and the time a packet is sent, but it gives no other information than that. --relative-timestamps Print a timestamp relative to the beginning of the connection before each line. Note that the time a packet is printed is between the time a packet is received and the time a packet is sent, but it gives no other information than that. --monotonic-timestamps Print a CLOCK_MONOTONIC (see clock_gettime(3)) timestamp each time a package is printed. This is likely to be the uptime of your system. Note that the time a packet is printed is between the time a packet is received and the time a packet is sent, but it gives no other information than that. --print-offsets Print offsets of all fields (useful to debug nested lists in protocol descriptions) --print-counts Print counts (useful to debug lists in protocol descriptions) ENVIRONMENT VARIABLES
DISPLAY Without --display the content of this variable is used to determine the server to connect to. (And without -n given to xauth to get the authentication tokens for this display.) FAKEDISPLAY Without --fakedisplay the content of this variable is used to determine how to listen for clients. (And without -n given to xauth to set the authentication tokens for this display.) If neither is given, xtrace will try :9 XAUTHORITY Without -n and without -f or -F your xauth program will most likely look into this variable for the file to get/save the authentica- tion tokens from/into. If this is not set it will most likely use $HOME/.Xauthority. REPORTING BUGS
Report bugs to <brlink@debian.org> or the Debian BTS. SEE ALSO
xauth(1), x(7x), COPYRIGHT
Copyright (C) 2005 Bernhard R. Link This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. xtrace 26 June 2009 XTRACE(1)
All times are GMT -4. The time now is 04:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy