LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 11-16-2018, 11:46 PM   #1
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 206
Blog Entries: 1

Rep: Reputation: Disabled
What are equivalent commands in a bash script created in debian for solaris?


I've created a script in debian and it runs correctly. I want to use it in other linux bases OS, such as solaris and hupex,...
Is there any way to convert it?
I have some commands that I don't know if there is in solaris or not! These are:
pgrep
whiptail
lscpu
free -m
,...
 
Old 11-17-2018, 01:05 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 11,046
Blog Entries: 7

Rep: Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780
there's two aspects to your question:
  1. it depends on the shell those distros are using, and which version of it. the easiest advice to give is to make all scripts POSIX compliant.
  2. nobody can tell you which external commands are available everywhere... things to do:
    a) use internal shell commands as much as possible
    b) for each external command, make a check if it can be used, maybe use an alternative if not or even let the script fail.
 
1 members found this post helpful.
Old 11-17-2018, 02:02 AM   #3
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.5
Posts: 2,567

Rep: Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876
The command which <command> will tell you if the command exists. Even on Solaris.

In what language/shell is the script written? Is that language or shell on the Solaris box?

Have you ported what you have to the Solaris box to test it? What happened?
 
Old 11-17-2018, 02:21 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 12,269

Rep: Reputation: 3793Reputation: 3793Reputation: 3793Reputation: 3793Reputation: 3793Reputation: 3793Reputation: 3793Reputation: 3793Reputation: 3793Reputation: 3793Reputation: 3793
there is no general solution, so if I want to be strict: the original question cannot be answered (there are no equivalent commands available).
But [almost] in any case you can find a replacement which will do [almost] the same thing (or returns the same answer), but it depends on the OS, the command itself and probably on other things too.
So there is no automated way, but most probably there is a way to make it (the script) work - by hand.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH connection from BASH script stops further BASH script commands tardis1 Linux - Newbie 3 12-06-2010 08:56 AM
[SOLVED] What is the equivalent of this bash script in sh script? archieval Programming 3 10-05-2010 03:09 AM
Linux equivalent commands for all Solaris commands Harry_Linux008 Linux - Newbie 4 08-22-2010 07:21 PM
bash script - get filename created by script using variables aolong Linux - General 8 11-19-2009 12:40 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 07:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration