Find the answer to your Linux question:
Results 1 to 8 of 8
Like Tree2Likes
  • 1 Post By Rubberman
  • 1 Post By drl
I don't understand what this does. It makes a listing of .sh files. Code: for FILE in *.sh; do shopt -u nullglob echo $FILE done...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2014
    Posts
    50

    shopt -u nullglob


    I don't understand what this does.

    It makes a listing of .sh files.

    Code:
    for FILE in *.sh; do
    shopt -u nullglob
    echo $FILE
    done

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,664
    The shopt command is a bash built-in command. Read the bash man page. There is a lot of information about how to use shopt and what it does - more than I can go into here for you. In any case, here is the section on the nullglob option:
    Code:
                  nullglob
                          If  set, bash allows patterns which match no files (see Pathname Expansion above) to expand to a
                          null string, rather than themselves.
    Clear as mud, right?
    fixit7 likes this.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Mar 2014
    Posts
    50
    Probably not something I could use at this time.

    Andy

  4. $spacer_open
    $spacer_close
  5. #4
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,294
    Hi.

    See also the-never-to-be-forgotten-document: The Linux Documentation Project: Guides specifically:
    shopt

    This command permits changing shell options on the fly (see Example 25-1 and Example 25-2). It often appears in the Bash startup files, but also has its uses in scripts. Needs version 2 or later of Bash.
    at Advanced Bash-Scripting Guide

    Best wishes ... cheers, drl
    fixit7 likes this.
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  6. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,664
    Myself, I've never used it, and wasn't even aware of it before this thread brought it to my attention. I suppose I'll have to go and experiment with it now!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #6
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,294
    Hi.

    I found a few places where nullglob is used in my library of scripts, but not that many. One script where it appears is the very useful inxi - A newer, better system information script for irc, administration, and system troubleshooters. - Google Project Hosting

    Best wishes ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  8. #7
    Just Joined!
    Join Date
    Mar 2014
    Posts
    50
    I could not read most of inxi's output.

    One of the colors was unreadable.

    Andy

  9. #8
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,294
    Hi.
    Quote Originally Posted by fixit7 View Post
    I could not read most of inxi's output.

    One of the colors was unreadable.
    Running:
    Code:
    $ inxi -h
    inxi supports the following options. You can combine them, or list them
    one by one: Examples: inxi -v4 -c6 OR inxi -bDc 6
    ...
    (much more)
    I usually use option -c0 to omit the coloring of text ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •