LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-02-2013, 12:56 PM   #1
RigsJuarez
LQ Newbie
 
Registered: Aug 2013
Posts: 3

Rep: Reputation: Disabled
Any shell scripts repository examples?


Hi all,

Is there any web site with common SysAdmin shell scripts repository examples?

I remember there was one with many categorized (file system/networking/processes, etc.) shell scripts but I can't find it anymore.

Regards.
 
Old 09-02-2013, 01:26 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,623

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by RigsJuarez View Post
Hi all,
Is there any web site with common SysAdmin shell scripts repository examples?

I remember there was one with many categorized (file system/networking/processes, etc.) shell scripts but I can't find it anymore.
Regards.
There are some sites like Hotscripts, and many more you can find with a Google search.
 
Old 09-02-2013, 11:06 PM   #3
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
I keep my common shell scripts in /usr/share/bash, and use this script to "include" the ones I want:
Code:
$ cat /usr/share/bash/include 
#!/bin/bash
# Define the function to include all the programs listed in "$*" from /usr/share/bash
#
# Usage: include function1 {function2 ...}
#
# Note: This function assumes that any function to be included may be an executable script
#       and searches $PATH for any match before looking in the location array entries.
#
# Define the include function if it's not already defined
if [ "$(type -t include)" != "function" ]
then
  include ()
  {
    local d f abort loc found
    local -a locations
# This is the array naming the locations to be searched
    locations=("/usr/share/bash" "${HOME}/Scripts/Bash")
    abort=0
    for f in "$@"
    do
      loc=$(type -P "${f}")
      if [ -z "${loc}" ]
      then
        found=0
        for d in "${locations[@]}"
        do
          if [ -f "${d}/${f}" ]
          then
            . "${d}/${f}"
            found=1
            break
          fi
        done
        if [[ ${found} == 0 ]]
        then
          echo Error: The bash include file \"${f}"\" could not be found." > /dev/stderr
          abort=$((++abort))
        fi
      else
        . "${loc}"
      fi
    done
    [ ${abort} -gt 0 ] && exit ${abort}
  }
fi
Here's an example of how I use it:
Code:
# Load the local function definitions
. /usr/share/bash/include
include define_colors \
        sucmd \
        connect_using_nmcli_to \
        vg_activate \
        mount_noauto \
        mount_cifs \
        mount_iso
 
1 members found this post helpful.
Old 05-13-2017, 05:34 PM   #4
ajb57
LQ Newbie
 
Registered: May 2017
Posts: 5

Rep: Reputation: Disabled
Linux-shell-base

For a resource of solutions to low-level shell scripting problems in Linux, see linux-shell-base. It provides solutions for multiple aspects of the Linux application layer.

Last edited by ajb57; 05-19-2017 at 01:58 PM.
 
Old 05-19-2017, 12:28 PM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
@ajb57 welcome to LQ.

Stop resurrecting very old questions and posting your same information and link.

If you wish to self-promote some code you may do so with a single new thread.

http://www.linuxquestions.org/questi...ts-4175538361/
http://www.linuxquestions.org/questi...es-4175509965/
http://www.linuxquestions.org/questi...es-4175420036/
http://www.linuxquestions.org/questi...es-4175475605/
 
  


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
Shell scripts repository RigsJuarez Programming 3 09-06-2013 01:55 PM
LXer: Linux shell: understanding Umask with examples LXer Syndicated Linux News 0 12-05-2012 11:12 PM
LXer: New Blog Post : GitHub Repository For Pygame Examples LXer Syndicated Linux News 0 12-17-2011 08:41 PM
writtign my own linux shell using BASH, guidelines? examples? thx cocchiararo Programming 33 05-16-2008 05:47 PM
Looking for a good list of shell commands with examples jk1 Linux - Newbie 4 06-11-2002 08:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:10 PM.

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