LinuxQuestions.org
Visit Jeremy's Blog.
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 03-10-2008, 08:45 AM   #1
ptcte
LQ Newbie
 
Registered: Feb 2007
Distribution: archlinux
Posts: 7

Rep: Reputation: 0
Question commands in linux


some commands in linux have an underscore at the start(eg. _something).why?
 
Old 03-10-2008, 09:09 AM   #2
aus9
LQ Guru
 
Registered: Oct 2003
Posts: 5,124

Rep: Reputation: Disabled
can you provide some examples and in what distro and in what folder pathway pls.

In mdv....I just did a quick check and I have none. AFAIK.
 
Old 03-10-2008, 09:44 AM   #3
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
I have them too, but if I try and run them, I get the following error:
Code:
pwc101@linux:~> _make
_make:compset:158: can only be called from completion function
(eval):1: no matches found: *:all-files
_tags:comptags:36: can only be called from completion function
_tags:comptry:55: can only be called from completion function
_tags:comptags:60: can only be called from completion function
_tags:comptags:67: can only be called from completion function
Code:
pwc101@linux:~> type _make
_make is a shell function
I'm using zsh.

Don't know what it's for, but this is it:
Code:
_make () {
        local prev="$words[CURRENT-1]" file expl tmp is_gnu dir incl
        expandVars () {
                local open close var val tmp=$2 ret=$2
                if (( $1 == 0 ))
                then
                        return
                fi
                while :
                do
                        var=${tmp#*\$}
                        if [[ $var != $tmp ]]
                        then
                                tmp=$var
                                case $var in
                                        (\(*) open='('
                                                close=')'  ;;
                                        ({*) open='{'
                                                close='}'  ;;
                                        ([[:alpha:]]*) open=''
                                                close=''
                                                var=${(s::)var[1]}  ;;
                                        (\$*) tmp=${tmp#\$} ;&
                                        (*) continue ;;
                                esac
                                if [[ $open != '' ]]
                                then
                                        var=${var#$open}
                                        var=${var%%$close*}
                                fi
                                case $var in
                                        ([[:alnum:]_]#) val=${(P)var}
                                                val=$(expandVars $(($1 - 1)) $v
al)
                                                ret=${ret//\$$open$var$close/$v
al}  ;;
                                esac
                        else
                                print -- ${ret//\$\$/\$}
                                return
                        fi
                done
        }
        parseMakefile () {
                local input var val TAB=$'\t' dir=$1
                while read input
                do
                        case "$input " in
                                ([[:alnum:]][[:alnum:]_]#[ $TAB]#=*) var=${inpu
t%%[ $TAB]#=*}
                                        val=${input#*=}
                                        val=${val##[ $TAB]#}
                                        eval $var=\$val ;;
                                ([[:alnum:]][[:alnum:]_]#[ $TAB]#:=*) var=${inp
ut%%[ $TAB]#:=*}
                                        val=${input#*=}
                                        val=${val##[ $TAB]#}
                                        val=$(expandVars 10 $val)
                                        eval $var=\$val ;;
                                ([[:alnum:]][^$TAB:=]#:[^=]*) input=${input%%:*
}
                                        print $(expandVars 10 $input) ;;
                                ($incl *) local f=${input##$incl ##}
                                        if [[ $incl = '.include' ]]
                                        then
                                                f=${f#[\"<]}
                                                f=${f%[\">]}
                                        fi
                                        f=$(expandVars 10 $f)
                                        case $f in
                                                (/*)  ;;
                                                (*) f=$dir/$f  ;;
                                        esac
                                        if [ -r $f ]
                                        then
                                                parseMakefile ${f%%/[^/]##} < $
f
                                        fi ;;
                        esac
                done
        }
        findBasedir () {
                local file index basedir
                basedir=$PWD
                for ((index=0; index<$#@; index++)) do
                        if [[ $@[index] = -C ]]
                        then
                                file=${~@[index+1]}
                                if [[ -z $file ]]
                                then
                                        return
                                elif [[ $file = /* ]]
                                then
                                        basedir=$file
                                else
                                        basedir=$basedir/$file
                                fi
                        fi
                done
                print -- $basedir
        }
        _pick_variant -r is_gnu gnu=GNU unix -v -f
        if [[ $is_gnu = gnu ]]
        then
                incl=include
        else
                incl=.include
        fi
        if [[ "$prev" = -[CI] ]]
        then
                _files -W ${(q)$(findBasedir ${words[1,CURRENT-1]})} -/
        elif [[ "$prev" = -[foW] ]]
        then
                _files -W ${(q)$(findBasedir $words)}
        else
                file="$words[(I)-f]"
                if (( file ))
                then
                        file=${~words[file+1]}
                        [[ $file = [^/]* ]] && file=${(q)$(findBasedir $words)}
/$file
                        [[ -r $file ]] || file=
                else
                        local basedir
                        basedir=${(q)$(findBasedir $words)}
                        if [[ $is_gnu = gnu && -r $basedir/GNUmakefile ]]
        else
                file="$words[(I)-f]"
                if (( file ))
                then
                        file=${~words[file+1]}
                        [[ $file = [^/]* ]] && file=${(q)$(findBasedir $words)}
/$file
                        [[ -r $file ]] || file=
                else
                        local basedir
                        basedir=${(q)$(findBasedir $words)}
                        if [[ $is_gnu = gnu && -r $basedir/GNUmakefile ]]
                        then
                                file=$basedir/GNUmakefile
                        elif [[ -r $basedir/makefile ]]
                        then
                                file=$basedir/makefile
                        elif [[ -r $basedir/Makefile ]]
                        then
                                file=$basedir/Makefile
                        else
                                file=''
                        fi
                fi
                if [[ -n "$file" ]] && _tags targets
                then
                        if [[ $is_gnu = gnu ]] && zstyle -t ":completion:${curc
ontext}:targets" call-command
                        then
                                tmp=($(_call_program targets "$words[1]" -nsp -
-no-print-directory -f "$file" .PHONY 2> /dev/null | parseMakefile $PWD))
                        else
                                tmp=($(parseMakefile $PWD < $file))
                        fi
                        _wanted targets expl 'make target' compadd -a tmp && re
turn 0
                fi
                compstate[parameter]="${PREFIX%%\=*}"
                compset -P 1 '*='
                _value "$@"
        fi
}
What a monster!

I have 496 such executables/functions in my PATH.
 
Old 03-10-2008, 09:51 AM   #4
aus9
LQ Guru
 
Registered: Oct 2003
Posts: 5,124

Rep: Reputation: Disabled
well normal make is a linear command

./configure
make
make install

done in sequence.

2) i use bash so if root powers....my pathways are in /root/.bashrc.

what file are you referring to pls?
 
Old 03-10-2008, 01:44 PM   #5
ararus
Member
 
Registered: Mar 2008
Location: UK
Distribution: Slackware
Posts: 56

Rep: Reputation: 15
zsh uses a _ prefix for tab completion functions.

You'll find them in /usr/share/zsh/$ZSH_VERSION/functions
 
Old 03-10-2008, 01:53 PM   #6
hashbangbinbash
Member
 
Registered: Mar 2008
Posts: 106

Rep: Reputation: 16
Quote:
Originally Posted by aus9 View Post
well normal make is a linear command

./configure
make
make install

done in sequence.
would this be ok to do that?

Quote:
./configure && make && make install
 
Old 03-10-2008, 02:11 PM   #7
felixc
Member
 
Registered: Jul 2005
Distribution: Debian
Posts: 94

Rep: Reputation: Disabled
Yup, that'll produce the same result.
 
Old 03-10-2008, 03:35 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Not quite the same. If you line them up in a script they'll all run in
sequence. If you chain them with the double ampersand (&&) the ones to
the right will only execute if the one(s) on the left were successful.

And no, that's not just semantics ;}



Cheers,
Tink
 
Old 03-10-2008, 06:23 PM   #9
ptcte
LQ Newbie
 
Registered: Feb 2007
Distribution: archlinux
Posts: 7

Original Poster
Rep: Reputation: 0
Question commands in linux

examples are man and _man.Iam using opensuse10.3 and bash with konsole.
when i type man i get what manual page do you want?when i type _man i get bash:COMP_WORDS:bad array subscript.i get these commands listed when press tab twice in bash.
 
Old 03-10-2008, 06:34 PM   #10
aus9
LQ Guru
 
Registered: Oct 2003
Posts: 5,124

Rep: Reputation: Disabled
ok found an example of files
http://www.novell.com/products/linux...linux/zsh.html

and zsh calls the (understem) a underscore _

http://www.csse.uwa.edu.au/programmi...oc/zsh_23.html
 
  


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
Linux Commands sunrajtech General 8 01-08-2008 11:23 AM
Help with Linux Commands Kjell Persson Linux - Newbie 4 02-10-2006 12:38 PM
Suse Linux Commands For These Aix Commands? Vaskar Guha Linux - Software 2 12-19-2005 01:45 AM
Linux commands Shikha Linux - General 3 11-27-2002 10:40 AM


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