UNIX provides the special variable HOME which is almost certainly set to your users' home directory already. RIAMP_HOME seems redundant.
The path RIAMP_HOME/bin/... doesn't expand to what you want it to because you didn't put braces around RIAMP_HOME. Try ${RIAMP_HOME}.
Your first test is to test if the home variable is blank, and execute code inside the if statement when true. Your next test is the same -- only execute code in this block if the string is blank. So, it's backwards -- it will never be executed when the string is set. It's also completely redundant, since you tested for that 3 lines ago. You can leave out that "if" completely. (For the record, to check if a string is not blank, you do if [ ! -z "${STRING}" ]
Shell script doesn't have "call". It has . or source instead (they are synonyms).
"call" is not a subroutine and never has been, though if you treat it carefully and squint a little it's kind of similar. UNIX shells, more modern ones anyway, have actual subroutines:
And lastly, you'd still be much better off rewriting from scratch than "translating" a batch file. Tons of things that could only be accomplished in CMD via diabolical tricks are easy one-liners in a real shell -- your big library of batch routines may be mostly redundant now. Just naively translating them like this won't teach you as much about real shell scripting, and will probably encourage some bad shell-programming habits.
Last edited by Corona688; 09-18-2010 at 04:23 PM..
Thank you very much Corona688. I really appreciate. I am working on some java development stuff as well. This would be time consuming if I write from scratch now. That is why i am writing corresponding code for the same. I would definitely try to write shell scripts though.
Hi,
I have a script file where i'm validatig the input file and storing the validated records on HDFS.
I wanted to load data from HDFS to HBASE using pig script. So for that i have created a HBASE table and written pig script to load data from HDFS to HBASE which is working fine. Now i wanted... (0 Replies)
Hi,
I wanted to load data from HDFS to HIVE by writing bash script.
Description:
I have written a bash script to validate the data and loaded validated data from local file system to HDFS. Now in the same bash script i wanted to load the data from HDFS to HIVE. How can i do it ? Also how tyhe... (2 Replies)
Experts,
I am newbie in shell scripting. I want to write Bash shell scripts corresponding to windows bat files. I have installed cygwin at c:\cygwin and i am trying to crate the sh file using vi editor. i am not able to understand how to use linux/unix convention for the code. following is my... (1 Reply)
can anyone help me in writing a shell script to visualize how simple commands work and on what logic. For Eg: ls command how it lists out all the files and directories, need to write a simple script based on the commands source code.:D (0 Replies)
Hello,
Is there a way to trigger a Windows bat file or program on a different machine from a different UNIX server using KSC file?
I hope you can assist me with this.
Thanks! (0 Replies)
I am currently taking a linux shell scripting class and also a intro to programming class using QBASIC. Will this interfere with how i learn each one? Are they similar in some ways? I already took a unix course based on the commands and it was easy, but now i have to create programs. Also, how... (1 Reply)
Hey guys,
I am working on my shell scripts in wordpad in windows. Then, I upload it to my unix using psftp, but when I open those files with "vi" in Unix, there are all these "^M" characters in the file. Would anyone of you have a clue as to why?
Help would be appreciated.
Thanks,
Laud (4 Replies)
Hi, I have just started a Systems Programming course and am required to write a c shell script as part of it.
I have little to no clue about unix.
The spec states that the script can be run only once on each host by a user, but the script can be run on different hosts by the one user.
... (2 Replies)