Sponsored Content
Top Forums Shell Programming and Scripting Create Bash shell scripts corresponding to windows bat files Post 302453712 by rajuchacha007 on Thursday 16th of September 2010 06:44:26 AM
Old 09-16-2010
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 code.

Code:
@ECHO OFF
 
IF NOT DEFINED MY_HOME goto home_not_set
 
IF DEFINED JAVA_HOME GOTO java_defined
ECHO Setting Java Home
set JAVA_HOME="%MY_HOME%\java\jre6_14"
SET PATH=%JAVA_HOME%\bin;%PATH%
 
:java_defined
set ACTIVEMQ_HOME=%MY_HOME%\message
GOTO end
 
:home_not_set
ECHO Set environment variable MY_HOME before running this script
GOTO end
 
:end
ENDLOCAL

where can i find a document or sample code to use in cygwin? i tried with #!/bin/bash. it started to print error at the end of file. do i need to set any path before writing scripts? please suggest or advise.

Thank you.

Last edited by Scott; 09-16-2010 at 08:21 AM.. Reason: Replaced ICODE tags with regular CODE tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

shell scripts to create 100 users

Hello i need a shell script to create 100 users i am running hp-ux......... startegy is something like this craete a shell script !/bin/ksh counter=1 while do { useradd usr$counter passwd usr$counter # here begins my problem when i say passwd usr$counter #it again prompts... (9 Replies)
Discussion started by: xiamin
9 Replies

2. 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

3. 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

4. Windows & DOS: Issues & Discussions

converting ksh scripts--.bat in window's

hi evry one , I did some ksh scripts for file editing in AIX 5.2 ver, issue is while I was trying to run these scripts in windows box as batch files windows is not recognising the awk part of the ksh script,as it is GNU environment, so any one who can help me will be appreciated. this is the... (3 Replies)
Discussion started by: 2.5lt V8
3 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. Shell Programming and Scripting

FTP is using shell scripts create ? for file

ftp -n -v <<EOF verbose open 3.57.40.79 user infodvlp pr0gram ascii lcd /home/a501420038/GLA/Success_Load/ cd /ftp/SrcFiles/csg/InstruAsia/ get AU_Success_Log.txt close quit EOF Please help on this, this gives the out put "AU_Success_Log.txt?" As question mark in the last what will... (1 Reply)
Discussion started by: a501420038
1 Replies

7. Shell Programming and Scripting

how to create and remove desktop icons from shell scripts

hi all how to create and remove desktop icons or icons from shell scripts? (1 Reply)
Discussion started by: kkpal
1 Replies

8. Shell Programming and Scripting

Writing 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... (15 Replies)
Discussion started by: rajuchacha007
15 Replies

9. Shell Programming and Scripting

How I can create this Shell scripts?

Hi friends you can solve my question about make 3 shell scripts? Thanks for all! (1 Reply)
Discussion started by: dakota
1 Replies

10. Shell Programming and Scripting

Using scripts to create output files

been messing around with linux for a few months...not too good yet. thinking about taking a class or something, this #### is hard.......anyway, im trying to make an output file using the input from a prompt. heres basically what i have now (random example) echo -n "Please enter your name: " read... (7 Replies)
Discussion started by: rickbobb4444
7 Replies
RBASH(1)						      General Commands Manual							  RBASH(1)

NAME
rbash - restricted bash, see bash(1) RESTRICTED SHELL
If bash is started with the name rbash, or the -r option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to bash with the exception that the follow- ing are disallowed or not performed: o changing directories with cd o setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV o specifying command names containing / o specifying a file name containing a / as an argument to the . builtin command o specifying a filename containing a slash as an argument to the -p option to the hash builtin command o importing function definitions from the shell environment at startup o parsing the value of SHELLOPTS from the shell environment at startup o redirecting output using the >, >|, <>, >&, &>, and >> redirection operators o using the exec builtin command to replace the shell with another command o adding or deleting builtin commands with the -f and -d options to the enable builtin command o using the enable builtin command to enable disabled shell builtins o specifying the -p option to the command builtin command o turning off restricted mode with set +r or set +o restricted. These restrictions are enforced after any startup files are read. When a command that is found to be a shell script is executed, rbash turns off any restrictions in the shell spawned to execute the script. SEE ALSO
bash(1) GNU Bash-4.0 2004 Apr 20 RBASH(1)
All times are GMT -4. The time now is 10:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy