Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Assistance to connect to servers via ssh once and collect various commands into separate variables Post 303038930 by RudiC on Tuesday 17th of September 2019 09:21:20 AM
Old 09-17-2019
Not sure I understand your questions / problems.
Of course, you can adapt the "command substitution" $(...) to fit your needs - in fact, you are required to do so as I only gave a proof of concept.
And, the read VAR1 VAR2 ... assigns each individual command line's output to its respective individual variable - did you try that? The way you propose can't be used as those variables used it the one single ssh session would be defined on the remote system and not expandable (not even existent) on your local system.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need script to connect sftp servers

Dear friends, i need to connect sftp server from my home directory using script . Please can anyone help me on this. (1 Reply)
Discussion started by: kittusri9
1 Replies

2. Shell Programming and Scripting

Need assistance with appending strings using sed and variables

HI, Can't seem to find anything on the forums to fix this. I have a file, one line within this will not have a specific string at the end. I have the string, but need to append it to the specific line which has it missing. I need to use a variable for this, $string - I am using double... (13 Replies)
Discussion started by: mandriver
13 Replies

3. Shell Programming and Scripting

Cant separate variables

Hey guys, new problem....im not being able to seperate variables. the code runs like this... OPTIONS=$(awk '{print $2}' /etc/fstab} a=$(zenity --list --text "Mount points selection" --radiolist --column "choice" --column "mountpt" FALSE $OPTIONS); echo $a Note: the result i get is that... (2 Replies)
Discussion started by: dplate07
2 Replies

4. Shell Programming and Scripting

Send Remote Commands via SSH with variables

Hi there I found the Command to send commands to other servers like: sv01> ssh user@sv02 'ps -ef' But I cant use Variables from a script i want to execute on another server like: sv01> ssh user@sv02 'cd $SCRIPTHOME' although the variable is set on sv01. How can I run commands on sv02 with... (2 Replies)
Discussion started by: DarkSwiss
2 Replies

5. UNIX for Dummies Questions & Answers

need assistance on Calling DB user from separate file in Shell script

Hi All, I need to execute a SQL via shell script and i am connecting to Oracle DB by this way $USERNAME1/$PASSWORD1@$STRING1 and i need to get username, password and string from someother file stored in the Unix Directory. $Username, $Password and $String is stored in File A in Path A and i want... (1 Reply)
Discussion started by: sathish.tn
1 Replies

6. Shell Programming and Scripting

connect to multiple servers using SSH and execute commands

Requirement: Run a shell script with below inputs file name checksum path the script should go to multiple servers (around 35) and verify the input cksum and if there is a mismatch display a simple message to the user that cksum verification failed. host details, user id /... (1 Reply)
Discussion started by: amicableperson
1 Replies

7. UNIX for Advanced & Expert Users

Collect files from different servers to a single server and append them

Hi, I have script1.sh on 3 servers. I want to collect output report generated by them to a single server and append all the reports. Please tell me how can i do this? (2 Replies)
Discussion started by: pratikm23
2 Replies

8. Shell Programming and Scripting

Shell script to connect to multiple ssh servers

Hello, I have access to several linux servers (mostly centos based) located in a DC in another country. from day to day I need to login to each of them to do some work (they dont have gui/window manager installed, I work only from console), or even to just do a check like df -h for disc usage.... (3 Replies)
Discussion started by: MaRiOsGR
3 Replies

9. Shell Programming and Scripting

Find active SSH servers w/ ssh keys on LAN

Hi, I am trying to complete my bash script in order to find which SSH servers on LAN are still active with the ssh keys, but i am frozen at this step: #!/bin/bash # LAN SSH KEYS DISCOVERY SCRIPT </etc/passwd \ grep /bin/bash | cut -d: -f6 | sudo xargs -i -- sh -c ' && cat... (11 Replies)
Discussion started by: syrius
11 Replies

10. UNIX for Advanced & Expert Users

Connect direct - SFTP - List of servers that I can connect

Greetings Experts, I am working for a bank client and have a question on connect-direct and SFTP. We are using Linux RedHat servers. We use connect-direct to transfer (NDM) files from one server to another server. At times, we manually transfer the files using SFTP from one server to another... (2 Replies)
Discussion started by: chill3chee
2 Replies
unknown(n)						       Tcl Built-In Commands							unknown(n)

__________________________________________________________________________________________________________________________________________________

NAME
unknown - Handle attempts to use non-existent commands SYNOPSIS
unknown cmdName ?arg arg ...? _________________________________________________________________ DESCRIPTION
This command is invoked by the Tcl interpreter whenever a script tries to invoke a command that does not exist. The default implementation of unknown is a library procedure defined when Tcl initializes an interpreter. You can override the default unknown to change its func- tionality, or you can register a new handler for individual namespaces using the namespace unknown command. Note that there is no default implementation of unknown in a safe interpreter. If the Tcl interpreter encounters a command name for which there is not a defined command (in either the current namespace, or the global namespace), then Tcl checks for the existence of an unknown handler for the current namespace. By default, this handler is a command named ::unknown. If there is no such command, then the interpreter returns an error. If the unknown command exists (or a new handler has been registered for the current namespace), then it is invoked with arguments consisting of the fully-substituted name and arguments for the original non-existent command. The unknown command typically does things like searching through library directories for a command proce- dure with the name cmdName, or expanding abbreviated command names to full-length, or automatically executing unknown commands as sub-pro- cesses. In some cases (such as expanding abbreviations) unknown will change the original command slightly and then (re-)execute it. The result of the unknown command is used as the result for the original non-existent command. The default implementation of unknown behaves as follows. It first calls the auto_load library procedure to load the command. If this succeeds, then it executes the original command with its original arguments. If the auto-load fails then unknown calls auto_execok to see if there is an executable file by the name cmd. If so, it invokes the Tcl exec command with cmd and all the args as arguments. If cmd cannot be auto-executed, unknown checks to see if the command was invoked at top-level and outside of any script. If so, then unknown takes two additional steps. First, it sees if cmd has one of the following three forms: !!, !event, or ^old^new?^?. If so, then unknown carries out history substitution in the same way that csh would for these constructs. Finally, unknown checks to see if cmd is a unique abbreviation for an existing Tcl command. If so, it expands the command name and executes the command with the original arguments. If none of the above efforts has been able to execute the command, unknown generates an error return. If the global variable auto_noload is defined, then the auto-load step is skipped. If the global variable auto_noexec is defined then the auto-exec step is skipped. Under nor- mal circumstances the return value from unknown is the return value from the command that was eventually executed. EXAMPLE
Arrange for the unknown command to have its standard behavior except for first logging the fact that a command was not found: # Save the original one so we can chain to it rename unknown _original_unknown # Provide our own implementation proc unknown args { puts stderr "WARNING: unknown command: $args" uplevel 1 [list _original_unknown {*}$args] } SEE ALSO
info(n), proc(n), interp(n), library(n), namespace(n) KEYWORDS
error, non-existent command Tcl unknown(n)
All times are GMT -4. The time now is 02:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy