Sponsored Content
Top Forums Shell Programming and Scripting How can i run the shell script from ABAP programming language Post 302531689 by Corona688 on Friday 17th of June 2011 12:58:51 PM
Old 06-17-2011
This script doesn't look right.

First of all, it's got a password kludged in with expect. Having to use expect to do it is a subtle hint, in mile-high neon letters, that you really shouldn't be doing this. ssh, sftp, scp, su, and sudo all require a tty for passwords as a security precaution, not because they're badly written. They did this because because stored passwords are an extremely bad idea. ssh also provided a safe alternative, shared keys.

If you use shared keys, you won't have to kludge anything with expect. Just having the right files in the right places on the client and server will allow sftp username@host to connect without prompting. There's articles all over the net for passwordless ssh/scp/sftp (all the same protocol connecting the same way). It'd make your code much less convoluted, too.

I also see what you mean about having the files in the same directory, now. Your script is downloading these files, it's not fixed data. It should be putting them in a separate directory somewhere, because you don't want the script to have write-access to the directory it's running itself from. It'd be capable of accidentally deleting itself if something really messed up.

Also, just renaming xls to csv doesn't convert the data from xls to csv any more than putting a book in a different cover changes the contents. The usual way to convert excel to csv usually involves perl scripts. I'll see if I can find the right module.

Code:
#!/bin/sh

sftp username@host <<EOF
cd /remote/path/
lcd /local/path/
mget GET_FILE*
EOF

# This doesn't do what you think it does.  Renaming a file doesn't change
# the contents, it's still an Excel file!
for I in GET_FILE.*
do
        mv $I GET_FILE_123${I#GET_FILE}.csv
done

# SEND AN EMAIL TO THE PARTICULAR USER THAT FILE HAS BEEN MOVED #TO THE /usr/sap/NXA/COMM/interface/FICO/. PLZ SEE THE DIRECTORY.
# Not sure these filenames are quite right.  And isn't there actually more than one?
uuencode GET_FILE_123.CSV GET_FILE_123.CSV.MAIL | mail -s "GET_FILE_123.CSV" VENKAT@yahoo.com

---------- Post updated at 10:58 AM ---------- Previous update was at 10:49 AM ----------

The obvious thing to search for was xls2csv, and here it is.

Last edited by Corona688; 06-17-2011 at 02:50 PM..
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Does the programming language matters?

I see you guys encouraged people studied and used C while they were working on UNIX. Does C++ or JAVA matter? And in the past threads, Neo, PxT, and other members recommanded lots good books. I think those people who asked for the references, such as Dominic, had experiences on sys admin or... (8 Replies)
Discussion started by: HOUSCOUS
8 Replies

2. Programming

c programming language

Can someone enligten me on what below program does? I understand getchar and putchar.. but what is this program suppose to do? I try to put printf on it, but it shows nothing.. can someone explain to me what this program is suppose to do? It is reading something and assigning to c? so, if... (8 Replies)
Discussion started by: convenientstore
8 Replies

3. UNIX for Dummies Questions & Answers

Carreer:Networking Programming in Unix (C programming Language)

Hello, I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies

4. UNIX for Dummies Questions & Answers

Is PERL a programming language?

I need a small and simple clarification... Can someone tell me whether PERL is a programming language or not. Also, can shell scripts also considered as programming language or not. Also, please tell me the exact difference between programming language and scripting. Please help.... (3 Replies)
Discussion started by: Anjan1
3 Replies

5. Programming

How is a new Web Development language written ?

I'm wondering how programmers develop new Web Development languages because I want to learn how everything begins from the start. Let's say I'm planning to write a new language for the Web. How do I do this? Is there anyone who knows about the way Web Development languages first appear ? I'm... (3 Replies)
Discussion started by: Anna Hussie
3 Replies

6. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

7. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies
platform::shell(n)					       Tcl Bundled Packages						platform::shell(n)

__________________________________________________________________________________________________________________________________________________

NAME
platform::shell - System identification support code and utilities SYNOPSIS
package require platform::shell ?1.1.4? platform::shell::generic shell platform::shell::identify shell platform::shell::platform shell _________________________________________________________________ DESCRIPTION
The platform::shell package provides several utility commands useful for the identification of the architecture of a specific Tcl shell. This package allows the identification of the architecture of a specific Tcl shell different from the shell running the package. The only requirement is that the other shell (identified by its path), is actually executable on the current machine. While for most platform this means that the architecture of the interrogated shell is identical to the architecture of the running shell this is not generally true. A counter example are all platforms which have 32 and 64 bit variants and where a 64bit system is able to run 32bit code. For these running and interrogated shell may have different 32/64 bit settings and thus different identifiers. For applications like a code repository it is important to identify the architecture of the shell which will actually run the installed packages, versus the architecture of the shell running the repository software. COMMANDS
platform::shell::identify shell This command does the same identification as platform::identify, for the specified Tcl shell, in contrast to the running shell. platform::shell::generic shell This command does the same identification as platform::generic, for the specified Tcl shell, in contrast to the running shell. platform::shell::platform shell This command returns the contents of tcl_platform(platform) for the specified Tcl shell. KEYWORDS
operating system, cpu architecture, platform, architecture platform::shell 1.1.4 platform::shell(n)
All times are GMT -4. The time now is 03:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy