LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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: 209
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: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,732

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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 Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,913

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
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



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 12:47 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
Open Source Consulting | Domain Registration