Sponsored Content
Top Forums Shell Programming and Scripting Read several variables from command output via SSH Post 303039908 by NKaede on Thursday 17th of October 2019 09:09:34 AM
Old 10-17-2019
Read several variables from command output via SSH

Hi Folks,

I'm currently trying to read several values into different variables.
Actually, what I'm doing works, but I get an error message.

My attempts are:
Code:
read strCPROC strIPROC strAPROC <<<$(ssh -n -T hscroot@$HMC "lshwres -r proc -m $strIDENT --level sys -F \"configurable_sys_proc_units installed_sys_proc_units curr_avail_sys_proc_units\"")

Code:
read strCPROC strIPROC strAPROC < <(ssh -n -T hscroot@$HMC "lshwres -r proc -m $strIDENT --level sys -F \"configurable_sys_proc_units installed_sys_proc_units curr_avail_sys_proc_units\"")

and both lead to the error message:
Code:
stty: standard input: Inappropriate ioctl for device

Can someone maybe help me to avoid this or maybe have another idea how to achieve that?

Thanks and kind regards,
Kaede
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cannot read variables after ssh with rc file (KSH)

Greetings all, I'm currently making use of the $HOME/.ssh/rc file to launch an automated shell script immediately after the user has been verified through ssh. The current problem that I'm facing now is that I am unable to use the "read" command anymore... seems like the "read" statements are... (0 Replies)
Discussion started by: rockysfr
0 Replies

2. UNIX for Dummies Questions & Answers

trouble using read to store values in variables from command output

I know there are caveats about using read in pipelines because read is treated by a subshell. I know this but I can't think of any way to accomplish this regardless, I'm still a rookie. I hope somebody will be able to interpret what it is that I'm trying to accomplish and correct me. ... (2 Replies)
Discussion started by: ProGrammar
2 Replies

3. Shell Programming and Scripting

Interpreting Logicals/Environment Variables using the read command

Hi All I have something that from the outset seems really trivial but in practice is not quite working. I have the following code sample in my shell script which illustrates the problem echo "enter home directory" read home mkdir $home/newdir The user then enters a logical $HOME... (3 Replies)
Discussion started by: kingpin2502
3 Replies

4. Fedora

ssh command to read server resources

what is the ssh command to read my server resources, like system operator, Ram installed, CPU etc....? (12 Replies)
Discussion started by: dan8354544
12 Replies

5. Shell Programming and Scripting

how to write 2 variables while using read command

Hello All i have input files contains 2 values as following 20-Oct-09 Z59408009 20-Oct-09 Z59423060 and i am using the following script cat /home/or/input.txt | awk '{print $2}' >log count=0 while read line; do count=$(( count + 1 )) echo "UPDATE SAT_JRLTRT SET AVT='X' WHERE... (6 Replies)
Discussion started by: mogabr
6 Replies

6. Shell Programming and Scripting

Environment Variables in text file and read command

I cannot get the following substitution ($ORACLE_SID) to work: The variable ORACLE_SID is set to wardin my environment. It has been exported. I have a text file called test.dat: /u07/oradata/${ORACLE_SID}/extab/finmart/summit/ps_voucher_line_crnt_ex.dbf... (2 Replies)
Discussion started by: bradyd
2 Replies

7. Shell Programming and Scripting

Format output from command from variables

Hi , I have below command to that outputs from variables.. command: echo $INSTANCE $DATAB $status $TSLastBackup| awk '{printf("%-8s %-8s \t \n",$1,$2,$3,$4)}' | tee $LOGF the ouput is now: INSTANCE DATABSE BACKUP_STATUS BACKUPTIMESTAMP ------- -------- -------- ... (1 Reply)
Discussion started by: db2_usd
1 Replies

8. Shell Programming and Scripting

Using a find command in ssh but using local variables?

I have a script like this (Yes, I know the DAY6 number isn't right - I'm just testing at this point): DAY0=`date -I` DAY1=`date -I -d "1 day ago"` DAY6=`date -I -d "2 days ago"` if then ssh root@synology1 nohup rm -rf "/volume1/Fileserver/$DAY6" fi I've tested the line to remove the... (5 Replies)
Discussion started by: Orionizer
5 Replies

9. Shell Programming and Scripting

Psql output into array and read 2 fields into different variables

Hello Just edited the entry to make it easier to understand what i want How can i achieve this: GOAL: read 2 field from a table with PSQL result of this PSQL command is this INSTALLEDLANG=$(su - postgres -c "psql -A -t -q -c -d ${DBNAME} -t -c 'SELECT code, iso_code from res_lang'") ... (0 Replies)
Discussion started by: winston6071
0 Replies

10. UNIX for Dummies Questions & Answers

Read in Multiple log files and output selected variables and values to cvs file

I have several problems with my problems: I hope you can help me. 1) the If else statement I am getting an error message. My syntax must be incorrect because the entire statement is throwing an error. For example in filew.log if these items don't exist Memsize, SASFoundation and also if... (0 Replies)
Discussion started by: dellanicholson
0 Replies
Tcl_LinkVar(3)						      Tcl Library Procedures						    Tcl_LinkVar(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_LinkVar, Tcl_UnlinkVar, Tcl_UpdateLinkedVar - link Tcl variable to C variable SYNOPSIS
#include <tcl.h> int Tcl_LinkVar(interp, varName, addr, type) Tcl_UnlinkVar(interp, varName) Tcl_UpdateLinkedVar(interp, varName) ARGUMENTS
Tcl_Interp *interp (in) Interpreter that contains varName. Also used by Tcl_LinkVar to return error messages. CONST char *varName (in) Name of global variable. char *addr (in) Address of C variable that is to be linked to varName. int type (in) Type of C variable. Must be one of TCL_LINK_INT, TCL_LINK_DOUBLE, TCL_LINK_WIDE_INT, TCL_LINK_BOOLEAN, | or TCL_LINK_STRING, optionally OR'ed with TCL_LINK_READ_ONLY to make Tcl variable read-only. _________________________________________________________________ DESCRIPTION
Tcl_LinkVar uses variable traces to keep the Tcl variable named by varName in sync with the C variable at the address given by addr. When- ever the Tcl variable is read the value of the C variable will be returned, and whenever the Tcl variable is written the C variable will be updated to have the same value. Tcl_LinkVar normally returns TCL_OK; if an error occurs while setting up the link (e.g. because varName is the name of array) then TCL_ERROR is returned and the interpreter's result contains an error message. The type argument specifies the type of the C variable, and must have one of the following values, optionally OR'ed with TCL_LINK_READ_ONLY: TCL_LINK_INT The C variable is of type int. Any value written into the Tcl variable must have a proper integer form acceptable to Tcl_GetIntFro- mObj; attempts to write non-integer values into varName will be rejected with Tcl errors. TCL_LINK_DOUBLE The C variable is of type double. Any value written into the Tcl variable must have a proper real form acceptable to Tcl_GetDouble- FromObj; attempts to write non-real values into varName will be rejected with Tcl errors. TCL_LINK_WIDE_INT The C variable is of type Tcl_WideInt (which is an integer type at least 64-bits wide on all platforms that can support it.) Any | value written into the Tcl variable must have a proper integer form acceptable to Tcl_GetWideIntFromObj; attempts to write non- | integer values into varName will be rejected with Tcl errors. TCL_LINK_BOOLEAN The C variable is of type int. If its value is zero then it will read from Tcl as ``0''; otherwise it will read from Tcl as ``1''. Whenever varName is modified, the C variable will be set to a 0 or 1 value. Any value written into the Tcl variable must have a proper boolean form acceptable to Tcl_GetBooleanFromObj; attempts to write non-boolean values into varName will be rejected with Tcl errors. TCL_LINK_STRING The C variable is of type char *. If its value is not NULL then it must be a pointer to a string allocated with Tcl_Alloc or | ckalloc. Whenever the Tcl variable is modified the current C string will be freed and new memory will be allocated to hold a copy of the variable's new value. If the C variable contains a NULL pointer then the Tcl variable will read as ``NULL''. If the TCL_LINK_READ_ONLY flag is present in type then the variable will be read-only from Tcl, so that its value can only be changed by modifying the C variable. Attempts to write the variable from Tcl will be rejected with errors. Tcl_UnlinkVar removes the link previously set up for the variable given by varName. If there does not exist a link for varName then the procedure has no effect. Tcl_UpdateLinkedVar may be invoked after the C variable has changed to force the Tcl variable to be updated immediately. In many cases this procedure is not needed, since any attempt to read the Tcl variable will return the latest value of the C variable. However, if a trace has been set on the Tcl variable (such as a Tk widget that wishes to display the value of the variable), the trace will not trigger when the C variable has changed. Tcl_UpdateLinkedVar ensures that any traces on the Tcl variable are invoked. KEYWORDS
boolean, integer, link, read-only, real, string, traces, variable Tcl 7.5 Tcl_LinkVar(3)
All times are GMT -4. The time now is 02:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy