- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Manage shell scripting environments
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
Forums
Discussions
Discussions
Discussions
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
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
08-06-2010 01:54 AM
08-06-2010 01:54 AM
I have taken over a couple of shell scripting suites and would like to know if there are any best practice guides or general practices on how to best manage large shell scripting environments while keeping them flexible?
In my case I have a large set of live scripts where most things are hard coded (paths and databases for example) and scripts are piggy backed onto each other (script1 calls script2 calls script 4 and so on...). To create a test environment is bit of a nightmare, pretty much every script have to be 'tweaked' to work in test.
I am looking to re-write quite a lot of it to make it workable and maintainable long term.
All ideas and advice would be most appreciated.
Thanks
Matt
Solved! Go to Solution.
- Tags:
- scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2010 02:22 AM
08-06-2010 02:22 AM
Re: Manage shell scripting environments
.Use funactions to keep the scripts as simple as much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2010 04:24 AM
08-06-2010 04:24 AM
Re: Manage shell scripting environments
Consider establishing includable files of common variables that you can source (read) as needed. This is done with the 'dot-space-filename' syntax so that no new environment is created. This approach can be used to conditionally choose to include either a production or a test suite of variable values based on a runtime argument.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2010 05:06 AM
08-06-2010 05:06 AM
SolutionYou could also build an includable file of functions that you want to deploy into more than one script. This file might look like:
# cat /home/matt/functions
#!/usr/bin/sh
function tattle
{
echo "tattle() saw $@"
}
function listdir
{
echo "current directory : $PWD"
ls
}
#_end_of_functions_
...and you could deploy it like:
# cat ./mytest
#!/usr/bin/sh
. /home/matt/functions
tattle "Mattias Johnsson"
cd /var/tmp && listdir
exit 0
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2010 04:25 PM
08-06-2010 04:25 PM
Re: Manage shell scripting environments
## config file
MAILRELAY=abc.xyz.com
MAILRELAYPORT=587
AUTHPLAIN="sdkchweiy43yutewurkw786h50ythbo="
REPLYTO=bill@bill.com
And just for extra credit, I added checks for these variables already preassigned so that the config file would only be used for default values.
Bill Hassell, sysadmin