Sponsored Content
Top Forums Shell Programming and Scripting Convert this Windows script so I can use it on Macbook Post 302693757 by richsark on Wednesday 29th of August 2012 04:34:27 PM
Old 08-29-2012
Convert this Windows script so I can use it on Macbook

Hi guys,

I am been banging my head for days on something that appears too simple to be so hard for me.

I have this bash script which I used just fine on my windows PC.

I took this file over to my Macbook and try to run it and it fails like no tomorrow.

This is the contents of the file:

Code:
#!/bin/bash
 
GM=$1
 
 
if [ "$1" == "-h" -o "$1" == "--help" -o "$#" -ne 1 ] ; then
  echo "$0 <GM_IPaddr> "
  echo " Provide the IP address of the Grid Master as the one argument to this command"
  exit 1
fi
 
 
wget --no-check-certificate https://${GM}/api/dist/CPA<wbr ></wbr>N/authors/<wbr ></wbr>id/SHARK
 
PerlPkg=`cat SHARK| grep "tar.gz" | awk -F'"' '{print $2}'`
PDIR=`echo $PerlPkg | sed 's/.tar.gz//'`
 
wget --no-check-certificate https://${GM}/api/dist/CPA<wbr ></wbr>N/authors/<wbr ></wbr>id/SHARK/$<wbr ></wbr>{PerlPkg}
 
tar xzvf $PerlPkg
 
mv $PerlPkg $PDIR
 
rm -f SHARK
 
cd $PDIR
   pwd
   /usr/bin/perl ./Makefile.PL
   /usr/bin/make
   /usr/bin/make test
   /usr/bin/make install
cd ..
 
##### End Script #####

Would someone be so kind into converting this so I can run it on my Macbook.

I may be wrong....
I think Mountain Lion using curl options using that URL bombs out until i am able to download a file named "SHARK"

Other errors seem to be due to MacOS being picky about arguments.

For example, it looks like it require the 'dash' prefix to the tar arguments, whereas any other normal Unix system does not.


Thank you in advance !
 

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to convert unix .ksh script to windows .batch script

I am using awk in my .ksh script but when I am trying to run in windows its not recognising awk part of the ksh script , even when I changed it to gawk it does not work, this is how my .ksh and .bat files look like. thanx. #!/bin/ksh egrep -v "Rpt 038|PM$|Parameters:|Begin |Date: |End... (1 Reply)
Discussion started by: 2.5lt V8
1 Replies

2. Shell Programming and Scripting

Trying to convert utf-8 to WINDOWS-1251

Hello all i have utf-8 file that i try to convert to WINDOWS-1251 on linux without any success the file name is utf-8 when i try to do : file -bi test.txt it gives me : text/plain; charset=utf-8 when i try to convert the file i do : /usr/bin/iconv -f UTF-8 -t WINDOWS-1251 test.txt >... (1 Reply)
Discussion started by: umen
1 Replies
CHECKBASHISMS(1)					      General Commands Manual						  CHECKBASHISMS(1)

NAME
checkbashisms - check for bashisms in /bin/sh scripts SYNOPSIS
checkbashisms script ... checkbashisms --help|--version DESCRIPTION
checkbashisms, based on one of the checks from the lintian system, performs basic checks on /bin/sh shell scripts for the possible presence of bashisms. It takes the names of the shell scripts on the command line, and outputs warnings if possible bashisms are detected. Note that the definition of a bashism in this context roughly equates to "a shell feature that is not required to be supported by POSIX"; this means that some issues flagged may be permitted under optional sections of POSIX, such as XSI or User Portability. In cases where POSIX and Debian Policy disagree, checkbashisms by default allows extensions permitted by Policy but may also provide options for stricter checking. OPTIONS
--help, -h Show a summary of options. --newline, -n Check for "echo -n" usage (non POSIX but required by Debian Policy 10.4.) --posix, -p Check for issues which are non POSIX but required to be supported by Debian Policy 10.4 (implies -n). --force, -f Force each script to be checked, even if it would normally not be (for instance, it has a bash or non POSIX shell shebang or appears to be a shell wrapper). --extra, -x Highlight lines which, whilst they do not contain bashisms, may be useful in determining whether a particular issue is a false posi- tive which may be ignored. For example, the use of "$BASH_ENV" may be preceded by checking whether "$BASH" is set. --version, -v Show version and copyright information. EXIT VALUES
The exit value will be 0 if no possible bashisms or other problems were detected. Otherwise it will be the sum of the following error val- ues: 1 A possible bashism was detected. 2 A file was skipped for some reason, for example, because it was unreadable or not found. The warning message will give details. SEE ALSO
lintian(1). AUTHOR
checkbashisms was originally written as a shell script by Yann Dirson <dirson@debian.org> and rewritten in Perl with many more features by Julian Gilbey <jdg@debian.org>. DEBIAN
Debian Utilities CHECKBASHISMS(1)
All times are GMT -4. The time now is 02:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy