Sponsored Content
Top Forums Shell Programming and Scripting How To Concatenate Two Commands in script using heredoc? Post 302931724 by kataria.anand on Thursday 15th of January 2015 05:43:37 AM
Old 01-15-2015
How To Concatenate Two Commands in script using heredoc?

Hello,

I am trying to place two commands in heredoc

below is the snippet
Code:
 if [ "$type" = "NP" ];then
                actionOnTux="$actVerb"
            else
                actionOnTux="$actVerb"
 fi
echo "Performing ACTION: $action on $tux@$srv .....\n"

                  if [ "$action" = "boot" ]; then
                        ssh -q $tux@$srv -n "1sftp >/dev/null 2>&1;~${tux}/scripts/inside_remote<<! 2>/dev/null
                        $actionOnTux

                        mq
!">${tuxFile} &


now what i want to do is based on value $type whether P or NP I want to concatenate an echo (precisely a newline character) with $actVerb, so that when $actionOnTux is executed i could get a single newline incase of NP and multiple newline in case of P

Last edited by Franklin52; 01-17-2015 at 04:50 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with a shell script to concatenate lists together

Below is a description of what im trying to achieve: Write a shell script to concatenate lists together, and output the resulting list. Do not include any argument that is a sub-list of the entire list. (The script will clean the list of any redundant items.) You must preserve the original order... (1 Reply)
Discussion started by: rfourn
1 Replies

2. Shell Programming and Scripting

Script to concatenate several files

I need a script to concatenate several files in one step, I have 3 header files say file.S, file.X and file.R, I need to concatenate these 3 header files to data files, say file1.S, file1.R, file1.X so that the header file "file.S" will be concatenated to all data files with .S extentions and so on... (3 Replies)
Discussion started by: docaia
3 Replies

3. Shell Programming and Scripting

HEREDOC with fdisk

Hi folks What I'm trying is to build a partitioning script. I can pass a HEREDOC to fdisk just fine. Like this: fdisk /dev/sda << EOF p q EOF but I don't know how to put that HEREDOC into a varible to pass it to fdisk. This is what I have tried so far (no luck) #!/bin/bash ... (3 Replies)
Discussion started by: latenite
3 Replies

4. Shell Programming and Scripting

Problem in SFTP using heredoc

Hi, I'm having heredoc to get files from ftp server. #!/bin/bash /export/opt/SCssh/3.7.1_C0/bin/sftp csi@192.168.1.100 <<GET_FILES lcd /WEBSERVER_LINK/data_logs/ ls -l pub/csidata/GeneralAppFields_8_1_Feed.out pub/csidata/CtcCatalog_7_3_3_Feed.out get... (13 Replies)
Discussion started by: bheeshmaraja
13 Replies

5. Shell Programming and Scripting

heredoc error check

Hi, Is there any way to check the error in heredoc? Code: /export/opt/SCssh/3.7.1_C0/bin/sftp -B - csi@192.168.1.100 <<FTP lcd /WEBSERVER_LINK/data_logs/ ls pub/csidata/GeneralAppFields_8_1_Feed.out get pub/csidata/GeneralAppFields_8_1_Feed.out quit FTP Now I want to check... (1 Reply)
Discussion started by: bheeshmaraja
1 Replies

6. UNIX for Advanced & Expert Users

Concatenate output in shell script

Hi Colleagues, I need the help in the followind. I execute this. select count(*) from schema.tablew the output is this. select count(*) from schema.table 3955 I need the followind output. select count(*) from schema.table 3955 Thank you for you help. (8 Replies)
Discussion started by: systemoper
8 Replies

7. Shell Programming and Scripting

Variables in heredoc

I currently use this message to send e-mails in a script but I would also like to save the output of this code to a file as well while preserving the variables. What's the easiest way to accomplish this? #Sending mail notification when=`/bin/date` /usr/sbin/sendmail -t >2 <<-EOM... (2 Replies)
Discussion started by: woodson2
2 Replies

8. Shell Programming and Scripting

Calling sqlplus from Korn shell heredoc issue

Hi, I am facing an issue wherein some temporary files (here docs) are getting created in /tmp and are not getting deleted automatically. When i check the list of open files with below command i can see one file is getting appended continuously.(In this case /tmp/sfe7h.34p) The output is... (4 Replies)
Discussion started by: Navin_Ramdhami
4 Replies

9. Shell Programming and Scripting

Echo multi-line string via heredoc syntax

$ cat bashtest #!/usr/local/bin/bash echo <<<"EOF" line1 line2 line3 EOF $ ./bashtest ./bashtest: line 3: line1: command not found ./bashtest: line 4: line2: command not found ./bashtest: line 5: line3: command not found ./bashtest: line 6: EOF: command not found What am i doing... (4 Replies)
Discussion started by: urello
4 Replies

10. Shell Programming and Scripting

Information on heredoc

Hi , I am using ksh on Aix 7.1 and found the below code in a script which is a bit confusing to me, any help will be appreciated <<comments put ${pathforfiles}/${ftpfilename} put ${logs}/${filename}.sch put ${logs}/${filename}.tgr comments I have searched for information on heredoc but... (2 Replies)
Discussion started by: zulfi123786
2 Replies
AUTH(8) 						      System Manager's Manual							   AUTH(8)

NAME
changeuser, wrkey, convkeys, printnetkey, status, auth.srv, guard.srv - maintain authentication databases SYNOPSIS
auth/changeuser [-np] user auth/wrkey auth/convkeys [-p] keyfile auth/printnetkey user auth/status user auth/auth.srv auth/guard.srv DESCRIPTION
These administrative commands run only on the authentication server. Changeuser manipulates an authentication database file system served by keyfs(4) and used by file servers. There are two authentication databases, one holding information about Plan 9 accounts and one hold- ing SecureNet keys. A user need not be installed in both databases but must be installed in the Plan 9 database to connect to a Plan 9 service. Changeuser installs or changes user in an authentication database. It does not install a user on a Plan 9 file server; see fs(8) for that. Option -p installs user in the Plan 9 database. Changeuser asks twice for a password for the new user. If the responses do not match or the password is too easy to guess the user is not installed. Option -n installs user in the SecureNet database and prints out a key for the SecureNet box. The key is chosen by changeuser. If neither option -p or option -n is given, changeuser installs the user in the Plan 9 database. Changeuser prompts for biographical information such as email address, user name, sponsor and department number and appends it to the file /adm/netkeys.who or /adm/keys.who. Wrkey prompts for a machine key, host owner, and host domain and stores them in local non-volatile RAM. Convkeys re-encrypts the key file keyfile. Re-encryption is performed in place. Without the -p option convkeys uses the key stored in /dev/keys to decrypt the file, and encrypts it using the new key. By default, convkeys prompts twice for the new password. The -p forces convkeys to also prompt for the old password. The format of keyfile is described in keyfs(4). Printnetkey displays the network key as it should be entered into the hand-held Securenet box. Status is a shell script that prints out everything known about a user and the user's key status. Auth.srv is the program, run only on the authentication server, that handles ticket requests on IL port 566. It is started by an incoming call to the server requesting a conversation ticket; its standard input and output are the network connection. Auth.srv executes the authentication server's end of the appropriate protocol as described in auth(6). Guard.srv is similar. It is called whenever a foreign (e.g. Unix) system wants to do a SecureNet challenge/response authentication. FILES
/adm/keys.who List of users in the Plan 9 database. /adm/netkeys.who List of users in the SecureNet database. SOURCE
/sys/src/cmd/auth SEE ALSO
keyfs(4), securenet(8) AUTH(8)
All times are GMT -4. The time now is 07:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy