- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: scripting differences between hpux and linux
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 05:49 AM
тАО07-23-2009 05:49 AM
scripting differences between hpux and linux
#!/usr/ksh
set -x
DN='"cn=Directory Manager"'
echo $DN
The outcome on HP-UX is what I'm expecting:
home> ./test
+ DN="cn=Directory Manager"
+ echo "cn=Directory Manager"
"cn=Directory Manager"
The outcome on Linux however is very slightly different:
[root]# sh test
+ DN='"cn=Directory Manager"'
+ echo '"cn=Directory' 'Manager"'
"cn=Directory Manager"
Anyone know why it's sticking the single quotes around the variable? When I pass ${DN} to a command later in the script it's failing because it splits it into ""cn=Directory" and "Manager"".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 05:52 AM
тАО07-23-2009 05:52 AM
Re: scripting differences between hpux and linux
Different shell, minor minor variations in functionality.
http://kornshell.com/
ksh
http://www.gnu.org/software/bash/manual/bashref.html
bash
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 05:57 AM
тАО07-23-2009 05:57 AM
Re: scripting differences between hpux and linux
sh test
command, which in turn have used the default shell you were using at the time, more than likely bash
does it run the same way if you call the script the same way you did in hpux machine ? I.e :
./test
Variable interpretations of shells are different for different shells.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 06:09 AM
тАО07-23-2009 06:09 AM
Re: scripting differences between hpux and linux
As posted, it's almost certainly one more little difference between ksh and bash. Bash is pretty close, but certainly not an exact copy of ksh. Check out array definition for more entertaining differences.
There are ksh rpms for linux. Depending on the distro, it may already be installed. Just switch the shell and you'll be good, I think.
Doug O'Leary
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 06:18 AM
тАО07-23-2009 06:18 AM
Re: scripting differences between hpux and linux
# uname -sr
HP-UX B.11.31
# cat de.sh
#!/usr/bin/ksh
set -x
DN="'cn=Directory Manager'"
echo "$DN"
# ./de.sh
+ DN='cn=Directory Manager'
+ echo 'cn=Directory Manager'
'cn=Directory Manager'
---------------------------------
# uname -or
2.6.9-42.EL GNU/Linux
# cat de.sh
#!/usr/bin/ksh
set -x
DN="'cn=Directory Manager'"
echo "$DN"
# ./de.sh
+ DN='cn=Directory Manager'
+ echo 'cn=Directory Manager'
'cn=Directory Manager'
As you can see - consistent...
HTH
Duncan
I am an HPE Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 06:19 AM
тАО07-23-2009 06:19 AM
Re: scripting differences between hpux and linux
#!/usr/ksh
That is what the script is going to run under. If you have pdksh on the linux box, then it will run under the korn shell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 06:21 AM
тАО07-23-2009 06:21 AM
Re: scripting differences between hpux and linux
I guess I have to ask why do you care, given that the differences are only in the trace?
Using '/usr/bin/ksh' [or for that matter '/usr/bin/sh'] on an Itanium 11.23 server:
+ DN="cn=Directory Manager"
+ echo "cn=Directory Manager"
"cn=Directory Manager"
Using '/bin/bash' on an OpenSUSE 11 server:
+ DN='"cn=Directory Manager"'
+ echo '"cn=Directory' 'Manager"'
"cn=Directory Manager"
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 06:28 AM
тАО07-23-2009 06:28 AM