LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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, 01: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, 02:26 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,272

Rep: Reputation: 4440Reputation: 4440Reputation: 4440Reputation: 4440Reputation: 4440Reputation: 4440Reputation: 4440Reputation: 4440Reputation: 4440Reputation: 4440Reputation: 4440
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-03-2013, 12:06 AM   #3
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
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, 06:34 PM   #4
ajb57
LQ Newbie
 
Registered: May 2017
Posts: 4

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 02:58 PM.
 
Old 05-19-2017, 01:28 PM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 5,844
Blog Entries: 12

Rep: Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010
@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


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

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

All times are GMT -5. The time now is 06:33 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration