Sponsored Content
Top Forums UNIX for Advanced & Expert Users Error while renaming the file in SFTP Session Post 302952014 by Corona688 on Wednesday 12th of August 2015 01:44:26 PM
Old 08-12-2015
This is wrong:

Code:
filename= echo $line | awk '{print $9}'

You already do this sort of thing correctly when you set DIRNAME, but you forgot to do so here. Also the extra space after the equals ruins it too.

Code:
filename=$(echo "$line" | awk '{ print $9 }' )

This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

sftp problem with user id of no telnet session allowed

We used to have a ftp user id with no telnet session allowed in server side. We used this ftp user id in script by transferring file from client to Server. Currently we need to implement sftp to replace ftp. We have tested few round and working fine by using sftp with normal user id (allow... (2 Replies)
Discussion started by: superdougl
2 Replies

2. Shell Programming and Scripting

Error while renaming file

After running he following command to rename a file: # mv 'Linux CPU (EDF).sh' LinuxCpu(EDF).sh I am getting the following error: -bash: syntax error near unexpected token `(' Why is this happening? (2 Replies)
Discussion started by: proactiveaditya
2 Replies

3. Shell Programming and Scripting

Catch error from SFTP session

We have script running to SFTP some file to the remote server. The problem is the SFTP transfer returns an exit code of 0 even if there is permission error during file transfer, connection refuse (like when sftp server is down), thus, returning the status of the script as success. I was thinking... (3 Replies)
Discussion started by: The One
3 Replies

4. Solaris

Cygwin X Server error: xdmcp fatal error session failed session 23 failed for display

Hi, i got the following error when i tried to access the cygwin x server from a windows XP PC. "xdmcp fatal error session failed session 23 failed for display" Alternatively, when i tried to access the same Cygwin X Server from another windows XP PC which is on a different LAN... (3 Replies)
Discussion started by: HarishKumarM
3 Replies

5. Shell Programming and Scripting

Execute shell script within sftp session

Hi all , can any one tell me how to run a script within a sftp session. let me tell u in bit clear way : After I connected to sftp location , cd ing to some directory then I need to execute a one script. Please tell me if u have any idea on this . Looking forward to your reply guys... (1 Reply)
Discussion started by: sravan008
1 Replies

6. Shell Programming and Scripting

Renaming a file while using SFTP

Hi All, I have a script which works perfectly for using SFTP commands. I use SFTP -b batchfile remoteuser@remoteserver. This batch file contains a command cd /dir1 put file1 I am wondering if there is a flag to rename a file on Remote server. I see the option rename file1... (6 Replies)
Discussion started by: Hangman2
6 Replies

7. Shell Programming and Scripting

bulk renaming of files in sftp using script

Hi, Am using sftp (dsa method) to transfer 20 files from one server(sftp) to another (local). After the transfer is complete the files in the sftp server has to be renamed from .txt extension to .done extension ( aa.txt to aa.done, bb.txt to bb.done and likewise...). I tried rename command... (4 Replies)
Discussion started by: Sindhuap
4 Replies

8. Solaris

sftp file renaming

Hi Admins, I am trying to get a file with different name including date format using sftp. For example --> get test.bak auto`date +"%Y%m%d"`err Here i am trying to get the file test.back with name auto20120126err But file is copied with the name auto`date --> date is not printing... (1 Reply)
Discussion started by: newaix
1 Replies

9. Shell Programming and Scripting

mkdir -p option in SFTP session

Hi, I am trying to create more than one directory by using -p option in SFTP session. But it created a directory named -p and ended. It didn't throw any error. sxxxxxxx:(abc)/test> sftp abcuser@zxxxxxxx Connecting to zxxxxxxx... Password: sftp> pwd Remote working directory: /test... (3 Replies)
Discussion started by: gthangav
3 Replies

10. Shell Programming and Scripting

SFTP batch not renaming file with "put"

I have a .ksh script that creates an sftp batch file and runs it through sftp. It works except for one thing. If I try to "put" to a different name, it doesn't use the specified remote name...it still "puts" the original local name. I've tried both of these, and neither work...it will always... (4 Replies)
Discussion started by: dbiggied
4 Replies
script(1)							   User Commands							 script(1)

NAME
script - make record of a terminal session SYNOPSIS
script [-a] [filename] DESCRIPTION
The script utility makes a record of everything printed on your screen. The record is written to filename. If no file name is given, the record is saved in the file typescript. See WARNINGS. The script command forks and creates a sub-shell, according to the value of $SHELL, and records the text from this session. The script ends when the forked shell exits or when Control-d is typed. OPTIONS
The following option is supported: -a Appends the session record to filename, rather than overwriting it. NOTES
script places everything that appears on the screen in filename, including prompts. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) WARNINGS
script can pose a security risk when used in directories that are writable by other users (for example, /tmp), especially when run by a privileged user, that is, root. Be sure that typescript is not a link before running script. SunOS 5.10 30 Jan 2004 script(1)
All times are GMT -4. The time now is 02:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy