Automate DIRECTORY ENTRY when in remote SHELL


 
Thread Tools Search this Thread
Operating Systems AIX Automate DIRECTORY ENTRY when in remote SHELL
# 1  
Old 03-31-2017
Automate DIRECTORY ENTRY when in remote SHELL

Good day all
I am trying to figure out how to automate the command [cd] in a shell script that i have written.
Some context:
The script does the following on the local host

Code:
#!/bin/sh
banner 'QikCopy'
echo "Please insert file name for SCP command!"
read file DUMMY
scp -p $file user@remotehost:/aim002/DSExtras/SeqFiles/
banner "Redirect"
ssh remotehost

The last line of code executes , it is at this point i would like to include a
Code:
cd

command to take me to a specified directory or access a soft link that alias's a directory on the remote shell Smilie
# 2  
Old 03-31-2017
ssh can take a (remote) command (-list) as a parameter, but I'd bet you want more than just a cd. Please give us more context. Did you consider using a "here document"?
# 3  
Old 03-31-2017
Thanks RudiC
The
Code:
cd

i want to execute will change into a directory which is aliased by a soft link for now .
But i will investigate as per your suggestion Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to find if any new entry in directory

I require a shell script to find if any new entry of dump files present in a particular directory and to send an email if any new entry exists.I had a crontab to run the script for every 5 min. Below are the file names.dump.20150327.152407.12058630.0002.phd.gz... (9 Replies)
Discussion started by: bhas85
9 Replies

2. Shell Programming and Scripting

Shell script to find the GB files in /tmp directory in remote server

Hi, i need help on shell scripting. Main intention of the script is step 1: ssh to remote server Step 2: cd /tmp in remote server Step 3: in tmp i want to grep only files and directories which are in GB sizes All the servers list file is - tmpsrv.txt vi tmpsrv.txt ... (17 Replies)
Discussion started by: kumar85shiv
17 Replies

3. Shell Programming and Scripting

SFTP script to automate login in to remote server

Greetings, guys. I'm not much of a programmer forgive me for being a noob, because of someone leaving, I was put in an IT spot where I have to figure out a few things. Being new to Linux and programming has been a challenge. My boss has asked me to create an automated script to connect to a 3rd... (7 Replies)
Discussion started by: giovannym
7 Replies

4. Shell Programming and Scripting

FTP files from different directory from remote server to one directory in local

Hi All, I want to search for .log files from folders and sub folders in remote server and FTP them to one particular folder in the local machine. I dont want to copy the entire directory tree structure, just have to take all the .log files from all the folders by doing a recursive search from the... (3 Replies)
Discussion started by: dassv
3 Replies

5. Shell Programming and Scripting

How to automate SSH remote connection with a shell script

Hi Guys! I am trying to write a shell script for automated ssh. vairable user and passwd have initialized correctly, but when I use the following it still prompting me for the password. #!/usr/bin/bash user='root@10.14.76.225' passwd='admin' ssh $user $passwd uptime exit I... (3 Replies)
Discussion started by: pinpe
3 Replies

6. UNIX for Dummies Questions & Answers

Not able to delete this file/directory/entry

Hello UNIX gurus, I noticed this file or whatever in one of our directories, and somehow I am not able to proceed with my work, without deleting this one. .insert--- 1 siebload intrface 0 Feb 22 01:25 Testfile I am confused, as it doesnt appear to be a file, and on doing any... (2 Replies)
Discussion started by: ppathak1234
2 Replies

7. Shell Programming and Scripting

Automate remote script

Hi all, I need to execute a script on a remote machine that are connected to the network.The basic requirement is to write a script which will login in remote machine and then execute the other script automatically placed in remote machine.So that I need to execute the remote machine script... (3 Replies)
Discussion started by: smartgupta
3 Replies

8. HP-UX

Getting the index of the last entry in a directory

Hello, Is there anyway of getting the index of the last entry in a directory? I'm using a C program to read the entries, but I want to go to the last entry because the directory is very big and I don't want to read all. I was using the size of the directory file descriptor but when I remove... (4 Replies)
Discussion started by: psimoes79
4 Replies

9. Shell Programming and Scripting

tcsh + completing a sub-directory entry

As part of a script Im designing, I am required to allow the command line to finish off part of a series of sub-directory entries. Basically what I want to do is cp /root/parent/part of subs name + other part of subs name/file /other_root/other_parent/other_sub/file without facing... (0 Replies)
Discussion started by: JamesGoh
0 Replies

10. Solaris

Automate to backup the /home directory

Can anybody know that how to automate backup the /home directory using the own shell script especially crontab job. How to script the code in starting process of the sun sparc server in /etc/init.d/ Thank's a lot. (1 Reply)
Discussion started by: kingsan
1 Replies
Login or Register to Ask a Question