Writing Bash shell scripts corresponding to windows bat files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Writing Bash shell scripts corresponding to windows bat files
# 8  
Old 09-17-2010
You can check this link in the forum which points to some books and excelent links: https://www.unix.com/shell-programmin...m-members.html

=o)
This User Gave Thanks to felipe.vinturin For This Post:
# 9  
Old 09-17-2010
@felipe.vinturin

Would you please explain what -z stands for? I tried to use different letter and it displays warning message. Thank you very much.

Best
# 10  
Old 09-17-2010
you can look below link for test constructs Smilie

Test Constructs
This User Gave Thanks to ygemici For This Post:
# 11  
Old 09-17-2010
@ygemici

Indeed thank you for the reply. I would like to know, why this if case(especially in my script courtesy felipe.vinturin) listens to few characters? like -p,-z etc and not to -n,-a,-q,.....etc. Is there any meaning for those characters like -n for negation or something like that? Thank you very much.

Best
# 12  
Old 09-17-2010
Quote:
Originally Posted by rajuchacha007
@felipe.vinturin

Would you please explain what -z stands for? I tried to use different letter and it displays warning message. Thank you very much.

Best
Try on your box: man test

Lets say, inside a shell script, an if statement is a "test" command call.
Code:
# man test
# ...
       -z STRING
              the length of STRING is zero
# ...

If you prefer, you can also use:
Code:
# var="Hello World"
# echo "The length of var is: [${#var}]"
The length of var is: [11]

# 13  
Old 09-17-2010
MySQL

Quote:
Originally Posted by rajuchacha007
@ygemici

Indeed thank you for the reply. I would like to know, why this if case(especially in my script courtesy felipe.vinturin) listens to few characters? like -p,-z etc and not to -n,-a,-q,.....etc. Is there any meaning for those characters like -n for negation or something like that? Thank you very much.

Best
of course we want to explain each one by one but list is very long Smilie
you can read the good document instead of and save the url very useful Smilie

Introduction to if
This User Gave Thanks to ygemici For This Post:
# 14  
Old 09-18-2010
Writing Bash shell scripts corresponding to windows bat files

Experts,
I am looking equivalent command for call in the unix. I am writing here whatever i have done so far after the batch file.

Code:
@ECHO OFF
CLS
IF DEFINED MY_HOME GOTO start ELSE GOTO home_not_set
call %MY_HOME%\bin\setvars.bat

:start
SET home=%cd%
chdir /d %MY_HOME%\app

SET args=%*
call "%java_home%\bin\java" -cp "conf;lib\*" com.myjava.myproject.commans.projectlog.MyLog %args%
GOTO end

:home_not_set
ECHO My_HOME environment variable is not set.

:end
chdir /d %home%
ENDLOCAL

here is what i have i tried so dar
Code:
# Riamp test
set riampPath=RIAMP_HOME/bin/setvars.sh
if [ -z "${RIAMP_HOME}" ]
then
	echo "Set environment variable RIAMP_HOME before running this script".
	exit 1
fi

# Riamp test
if [ -z "${RIAMP_HOME}" ]
then
	call "riampPath"
fi

i know unix does not have goto statements. we can use subroutine instead. Thank you.

Last edited by rajuchacha007; 09-18-2010 at 10:55 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Writing Hbase and pig scripts in the bash script file

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)
Discussion started by: shree11
0 Replies

2. Shell Programming and Scripting

Writing hive scripts in bash script file

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)
Discussion started by: shree11
2 Replies

3. Shell Programming and Scripting

Create Bash shell scripts corresponding to windows bat files

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)
Discussion started by: rajuchacha007
1 Replies

4. Shell Programming and Scripting

writing shell scripts of commands

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)
Discussion started by: rahul_11d
0 Replies

5. UNIX for Dummies Questions & Answers

Q about windows bat files

Hi, can you run a windows bat file or a VBscript from a shell script? #!/bin/sh PATH=/ $PATH/test.bat (1 Reply)
Discussion started by: cmac
1 Replies

6. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

7. Windows & DOS: Issues & Discussions

Urgent Need for Assistance: Triggering Windows bat files from UNIX

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)
Discussion started by: punyenye
0 Replies

8. Shell Programming and Scripting

Is writing shell scripts different than...

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)
Discussion started by: brentdeback
1 Replies

9. Shell Programming and Scripting

FTP Shell Scripts from Windows to Unix: files have exotic characters

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)
Discussion started by: Laud12345
4 Replies

10. UNIX for Dummies Questions & Answers

help for newbie writing shell scripts

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)
Discussion started by: richgi
2 Replies
Login or Register to Ask a Question