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
ssh-agent(1)							   User Commands						      ssh-agent(1)

NAME
ssh-agent - authentication agent SYNOPSIS
ssh-agent [-a bind_address] [-c | -s ] [-d] [ command [args...]] ssh-agent [-c | -s] -k DESCRIPTION
ssh-agent is a program to hold private keys used for public key authentication (RSA, DSA). ssh-agent is often started at the beginning of a login session. All other windows or programs are started as clients to the ssh-agent program. Through use of environment variables, the agent can be located and automatically used for authentication when logging in to other machines using ssh(1). (See System Administration Guide: Security Services.) If a command line is given, this is executed as a subprocess of the agent. When the command dies, so does the agent. The agent initially does not have any private keys. Keys are added using ssh-add(1), which sends the identity to the agent. Several identi- ties can be stored in the agent; the agent can automatically use any of these identities. Use the -l option in ssh-add(1) to display the identities currently held by the agent. The agent is run in the user's local host. Authentication data need not be stored on any other machine, and authentication passphrases never go over the network. However, if the connection to the agent is forwarded over SSH remote logins, the user can use the privileges given by the identities anywhere in the network in a secure way. There are two main ways to get an agent setup. Either you let the agent start a new subcommand into which some environment variables are exported, or you let the agent print the needed shell commands (either sh(1) or csh(1) syntax can be generated) which can be evalled in the calling shell. Later, use ssh(1) to look at these variables and use them to establish a connection to the agent. A unix-domain socket is created (/tmp/ssh-XXXXXXXX/agent.pid) and the name of this socket is stored in the SSH_AUTH_SOCK environment vari- able. The socket is made accessible only to the current user. This method is easily abused by root or another instance of the same user. The SSH_AGENT_PID environment variable holds the agent's PID. The agent exits automatically when the command given on the command line terminates. OPTIONS
The following options are supported: -a bind_address Binds the agent to the unix-domain socket bind_address. The default is /tmp/ssh-XXXXXXXX/agent.pid. -c Generates C-shell commands on stdout. This is the default if SHELL indicates that it is a csh style of shell. -d Debug mode. When this option is specified, ssh-agent will not fork. -k Kills the current agent (given by the SSH_AGENT_PID environment variable). -s Generates Bourne shell commands on stdout. This is the default if SHELL does not indicate that it is a csh style of shell. EXIT STATUS
The following exit values are returned: 0 Successful completion. 1 An error occurred. FILES
/tmp/ssh-XXXXXXXX/agent.pid Unix-domain sockets used to contain the connection to the authentication agent. These sockets should only be readable by the owner. The sockets are removed when the agent exits. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsshu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
ssh(1), ssh-add(1), ssh-keygen(1), sshd(1M), attributes(5) System Administration Guide: Security Services To view license terms, attribution, and copyright for OpenSSH, the default path is /var/sadm/pkg/SUNWsshdr/install/copyright. If the Solaris operating environment has been installed anywhere other than the default, modify the given path to access the file at the installed location. AUTHORS
OpenSSH is a derivative of the original and free ssh 1.2.12 release by Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt and Dug Song removed many bugs, added newer features and created Open SSH. Markus Friedl contributed the support for SSH pro- tocol versions 1.5 and 2.0. SunOS 5.10 9 Jan 2004 ssh-agent(1)
All times are GMT -4. The time now is 12:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy