Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!

Ogłoszenie

Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.

#1  2007-06-25 02:04:53

  Ryszard - Piwo DUG

Ryszard
Piwo DUG
Skąd: Zadupia
Zarejestrowany: 2006-06-30

Bash

siedze i mysle i nic utknołem na tym nie wiem co wpisać
The following Module are available:

username hostname date time workdir

please type them **exactly** like above
oraz tu
Please type in a sepeartor, which will be displayed between the entries:

for example: |
mam fajną konsole date czas kolory ale po restarcie nanowo mnie bash wypytuje o konfiguracje hmmmmmmmm stoje w miejscu
Choose the first Module:
CO TU KUR>........mam wpisać
ZA pomoc wielka dzięka


http://img196.imageshack.us/img196/3770/freebsde.jpg

Offline

 

#2  2007-06-25 07:34:28

  azhag - Admin łajza

azhag
Admin łajza
Skąd: Warszawa
Zarejestrowany: 2005-11-15

Re: Bash

ale co konkretnie robisz? jakie moduły, od czego?

ogólnie można tylko przypomnieć, aby wszelkie ustawienia wpisać w .bashrc


Błogosławieni, którzy czynią FAQ.
opencaching :: debian sources.list :: coś jakby blog :: polski portal debiana :: linux user #403712

Offline

 

#3  2007-06-26 15:58:32

  Ryszard - Piwo DUG

Ryszard
Piwo DUG
Skąd: Zadupia
Zarejestrowany: 2006-06-30

Re: Bash

mniej więcej to tak wygląda
#!/bin/bash

BASHRC="${HOME}/.bash_style_rc"

echo -e ""
echo -e "Will create the following configfile: "
echo -e ""
echo -e "${BASHRC}"

if [[ ${BASHRC} ]]; then
    echo -e ""
    echo -e "Backingup old configfiles to ${BASHRC}.old and ${HOME}/.bashrc.old"
    mv ${BASHRC} ${BASHRC}.old 2>/dev/null
    mv ${HOME}/.bashrc ${HOME}/.bashrc.old 2>/dev/null
    touch ${HOME}/.bashrc
    touch ${BASHRC}
else touch ${BASHRC}
fi

echo -e ""
echo -e "Enabling ${BASHRC} on Shell Startup"
echo "source ${BASHRC}" >> ${HOME}/.bashrc
echo -e "${BASHRC} enabled"

echo -e ""
echo -e "Enabling Colors."
echo "export black="[33[30m]"" >> ${BASHRC}
echo "export grey="[33[1;30m]"" >> ${BASHRC}
echo "export red="[33[1;31m]"" >> ${BASHRC}
echo "export green="[33[1;32m]"" >> ${BASHRC}
echo "export yellow="[33[1;33m]"" >> ${BASHRC}
echo "export blue="[33[1;34m]"" >> ${BASHRC}
echo "export magenta="[33[1;35m]"" >> ${BASHRC}
echo "export cyan="[33[1;36m]"" >> ${BASHRC}
echo "export white="[33[1;37m]"" >> ${BASHRC}
echo -e "Colors enabled."

echo -e ""
echo -e "The following colors are available:"
echo -e ""
echo -e "black grey red green yellow blue magenta cyan white"
echo -e ""
echo -e "Please type them **exactly** like above!"
echo -e ""

echo -e "Choose Color for Username: "
echo -ne " >> "
read USERCOLOR

echo -e ""
echo -e "Choose Color for Time: "
echo -ne " >> "
read TIMECOLOR

echo -e ""
echo -e "Choose wether to display time in 12 or 24 hours format: "
echo -ne " 12/24 >> "
read TIMEFORMAT

if [[ ${TIMEFORMAT} == 12 ]]; then
    TF="\T"
elif [[ ${TIMEFORMAT} == 24 ]]; then
    TF="\t"
else echo "No known Time Format typed in, exiting" || exit
fi

echo -e ""
echo -e "Choose Color for Date: "
echo -ne " >> "
read DATECOLOR

echo -e ""
echo -e "Choose Color for Hostname: "
echo -ne " >> "
read HOSTCOLOR

echo -e ""
echo -e "Choose wether to display the Hostname with or without domain: "
echo -ne " with/without >> "
read HOSTSTYLE

if [[ ${HOSTSTYLE} == with ]]; then
    HS="\H"
elif [[ ${HOSTSTYLE} == without ]]; then
    HS="\h"
else echo -e "you have to type "with" or "without", exiting" || exit
fi

echo -e ""
echo -e "Choose Color for Current-Directory: "
echo -ne " >> "
read CURDIRCOLOR

echo -e ""
echo -e "Choose Color for Normal Text: "
echo -ne " >> "
read FONTCOLOR

echo -e ""
echo -e "Please type in a sepeartor, which will be displayed between the entries: "
echo -e ""
echo -e "for example: | "
echo -ne " >> "
read SEPERATOR

echo -e ""
echo -e "Choose Color for the Seperators: "
echo -ne " >> "
read SEPERATORCOLOR

SEP="${SEPERATORCOLOR} ${SEPERATOR}"

echo -e ""
echo -e "The following Module are available: n"
echo -e "username hostname date time workdir n"
echo -e "please type them **exactly** like above"

echo -e ""
echo -e "Choose the first Module: "
echo -ne " >> "
read FIRSTMOD

if [[ ${FIRSTMOD} == username ]]; then
    FIRSTMOD="${USERCOLOR} \u"
elif [[ ${FIRSTMOD} == hostname ]]; then
    FIRSTMOD="${FONTCOLOR} on$${HOSTCOLOR} ${HS}"
elif [[ ${FIRSTMOD} == date ]]; then
    FIRSTMOD="${DATECOLOR} \d"
elif [[ ${FIRSTMOD} == time ]]; then
    FIRSTMOD="${TIMECOLOR} ${TF}"
elif [[ ${FIRSTMOD} == workdir ]]; then
    echo -e ""
    echo -e "Do you want the basename or the full path of the workdir to be shown?"
    echo -e "if you don't know what this is, type: f"
    echo -ne " f/b >> "
    read WORKSTYLE
    if [[ ${WORKSTYLE} == f ]]; then
        echo -e ""
        echo -e "Displaying full path of workdir"
        FIRSTMOD="${CURDIRCOLOR} \w"
    else echo -e ""
        echo -e "Displaying basename of workdir"
        FISTMOD="${CURDIRCOLOR} \W"
    fi
else echo -e "No known Module name choosen, exiting" || exit
fi

echo -e ""
echo -e "Choose the Second Module: "
echo -ne " >> "
read SECMOD

if [[ ${SECMOD} == username ]]; then
    SECMOD="${USERCOLOR} \u"
elif [[ ${SECMOD} == hostname ]]; then
    SECMOD="${FONTCOLOR} on$${HOSTCOLOR} ${HS}"
elif [[ ${SECMOD} == date ]]; then
    SECMOD="${DATECOLOR} \d"
elif [[ ${SECMOD} == time ]]; then
    SECMOD="${TIMECOLOR} ${TF}"
elif [[ $SECMOD == workdir ]]; then
    echo -e ""
    echo -e "Do you want the basename or the full path of the workdir to be shown?"
    echo -e "if you don't know what this is, type: f"
    echo -ne " f/b >> "
    read WORKSTYLE
    if [[ ${WORKSTYLE} == f ]]; then
        echo -e ""
        echo -e "Displaying full path of workdir"
        SECMOD="${CURDIRCOLOR} \w"
    else echo -e ""
        echo -e "Displaying basename of workdir"
        SECMOD="${CURDIRCOLOR} \W"
    fi
else echo -e "No known Module name choosen, exiting" || exit
fi

echo -e ""
echo -e "Choose the Third Module: "
echo -ne " >> "
read THIRDMOD

if [[ ${THIRDMOD} == username ]]; then
    THIRDMOD="${USERCOLOR} \u"
elif [[ ${THIRDMOD} == hostname ]]; then
    THIRDMOD="${FONTCOLOR} on$${HOSTCOLOR} ${HS}"
elif [[ ${THIRDMOD} == date ]]; then
    THIRDMOD="${DATECOLOR} \d"
elif [[ ${THIRDMOD} == time ]]; then
    THIRDMOD="${TIMECOLOR} ${TF}"
elif [[ ${THIRDMOD} == workdir ]]; then
    echo -e ""
    echo -e "Do you want the basename or the full path of the workdir to be shown?"
    echo -e "if you don't know what this is, type: f"
    echo -ne " f/b >> "
    read WORKSTYLE
    if [[ ${WORKSTYLE} == f ]]; then
        echo -e ""
        echo -e "Displaying full path of workdir"
        THIRDMOD="${CURDIRCOLOR} \w"
    else echo -e ""
        echo -e "Displaying basename of workdir"
        THIRDMOD="${CURDIRCOLOR} \W"
    fi
else echo -e "No known Module name choosen, exiting" || exit
fi

echo -e ""
echo -e "Choose the Fourth Module: "
echo -ne " >> "
read FOURTHMOD

if [[ ${FOURTHMOD} == username ]]; then
    FOURTHMOD="${USERCOLOR} \u"
elif [[ ${FOURTHMOD} == hostname ]]; then
    FOURTHMOD="${FONTCOLOR} on$${HOSTCOLOR} ${HS}"
elif [[ ${FOURTHMOD} == date ]]; then
    FOURTHMOD="${DATECOLOR} \d"
elif [[ ${FOURTHMOD} == time ]]; then
    FOURTHMOD="${TIMECOLOR} ${TF}"
elif [[ ${FOURTHMOD} == workdir ]]; then
    echo -e ""
    echo -e "Do you want the basename or the full path of the workdir to be shown?"
    echo -e "if you don't know what this is, type: f"
    echo -ne " f/b >> "
    read WORKSTYLE
    if [[ ${WORKSTYLE} == f ]]; then
        echo -e ""
        echo -e "Displaying full path of workdir"
        FOURTHMOD="${CURDIRCOLOR} \w"
    else echo -e ""
        echo -e "Displaying basename of workdir"
        FOURTHMOD="${CURDIRCOLOR} \W"
    fi
else echo -e "No known Module name choosen, exiting" || exit
fi

echo -e ""
echo -e "Choose the Last Module: "
echo -ne " >> "
read LASTMOD

if [[ ${LASTMOD} == username ]]; then
    LASTMOD="${USERCOLOR} \u"
elif [[ ${LASTMOD} == hostname ]]; then
    LASTMOD="${FONTCOLOR} on$${HOSTCOLOR} ${HS}"
elif [[ ${LASTMOD} == date ]]; then
    LASTMOD="${DATECOLOR} \d"
elif [[ ${LASTMOD} == time ]]; then
    LASTMOD="${TIMECOLOR} ${TF}"
elif [[ ${LASTMOD} == workdir ]]; then
    echo -e ""
    echo -e "Do you want the basename or the full path of the workdir to be shown?"
    echo -e "if you don't know what this is, type: f"
    echo -ne " f/b >> "
    read WORKSTYLE
    if [[ ${WORKSTYLE} == f ]]; then
        echo -e ""
        echo -e "Displaying full path of workdir"
        LASTMOD="${CURDIRCOLOR} \w"
    else echo -e ""
        echo -e "Displaying basename of workdir"
        LASTMOD="${CURDIRCOLOR} \W"
    fi
else echo -e "No known Module name choosen, exiting" || exit
fi

echo -e ""
echo -e "Do you want the version of bash to be displayed? "
echo -ne " y/n >> "
read WANTBV

if [[ ${WANTBV} == y ]]; then
    echo -e ""
    echo -e "What Color to use for bash version?"
    echo -ne " >> "
    read BASHVCOL
    echo -e ""
    echo -e "Do you also want the patchlevel to be displayed? "
    echo -e ""
    echo -e "if you don't know what this is, then type: n "
    echo -ne " y/n >> "
    read WANTBVP
        if [[ ${WANTBVP} == y ]]; then
            BASHV="${SEP} ${BASHVCOL} \V"
        elif [[ ${WANTBVP} == n ]]; then
            BASHV="${SEP} ${BASHVCOL} \v"
        else echo "not showing patch-level of bash"
        fi
else echo "not showing version of bash" || exit
fi

echo -e ""
echo -e "Do you want the number of the current command to be displayed? "
echo -ne " y/n >> "
read COMNUDISP

if [[ ${COMNUDISP} == y ]]; then
    echo -e ""
    echo -e "What Color to use for command number?"
    echo -ne " >> "
    read COMNUDISPCOL
    COMSTYLE="${SEP} $${FONTCOLOR} command number: ${COMNUDISPCOL} \!"
else echo -e "Current Command Number won't be displayed"
fi

echo -e ""
echo -e "Writing Settings to ${BASHRC}"
if [[ ${WANTBV} == y && ${COMNUDISP} == n ]]; then
    echo "export PS1="$${FIRSTMOD} $${SEP} $${SECMOD} $${SEP} $${THIRDMOD} $${SEP} $${FOURTHMOD} $${SEP} $${LASTMOD} $${BASHV} $${SEP} n$${USERCOLOR} $ $${FONTCOLOR}-> "" >> ${BASHRC}
elif [[ ${WANTBV} == y && ${COMNUDISP} == y ]]; then
    echo "export PS1="$${FIRSTMOD} $${SEP} $${SECMOD} $${SEP} $${THIRDMOD} $${SEP} $${FOURTHMOD} $${SEP} $${LASTMOD} $${BASHV} $${COMSTYLE} $${SEP} n$${USERCOLOR} $ $${FONTCOLOR}-> "" >> ${BASHRC}
elif [[ ${WANTBV} == n && ${COMNUDISP} == y ]]; then
    echo "export PS1="$${FIRSTMOD} $${SEP} $${SECMOD} $${SEP} $${THIRDMOD} $${SEP} $${FOURTHMOD} $${SEP} $${LASTMOD} $${COMSTYLE} $${SEP} n$${USERCOLOR} $ $${FONTCOLOR}-> "" >> ${BASHRC}
else echo "export PS1="$${FIRSTMOD} $${SEP} $${SECMOD} $${SEP} $${THIRDMOD} $${SEP} $${FOURTHMOD} $${SEP} $${LASTMOD} $${SEP} n$${USERCOLOR} $ $${FONTCOLOR}-> "" >> ${BASHRC}
fi

echo -e ""
echo -e "Prompt set and should work."
echo -e ""
echo -e "Which character do you want for PS2, PS3, PS4? "
echo -e ""
echo -e "If you don't know what this is, then type: > "
echo -ne " >> "
read PSCHAR

echo "export PS2="$${FONTCOLOR} ${PSCHAR}" " >> ${BASHRC}
echo "export PS3="$${FONTCOLOR} ${PSCHAR}${PSCHAR}" " >> ${BASHRC}
echo "export PS4="$${FONTCOLOR} ${PSCHAR}${PSCHAR}${PSCHAR}" " >> ${BASHRC}

echo -e ""
echo -e "Do you want colored output from "ls"? "
echo -ne " y/n >> "
read LSCOL

if [[ ${LSCOL} == y ]]; then
    echo -e ""
    echo -e "Enabling colored output from "ls""
    echo "alias ls='ls --color'" >> ${BASHRC}
else echo -e "Not enabling colored output from "ls""
fi

echo -e ""
echo -e "Do you want to set a timeout (bash will automatically logout then)?"
echo -ne " y/n >> "
read WANTTMOUT

if [[ ${WANTTMOUT} == y ]]; then
    echo -e ""
    echo -e "How long (in seconds) shall the timeout be?"
    echo -ne " >> "
    read TMSEC
    echo -e ""
    echo -e "Enabling Timeout"
    echo "TMOUT="${TMSEC}"" >> ${BASHRC}
else echo "not enabling timeout"
fi

echo -e ""
echo -e "Do you want to change History Control Format?"
echo -ne " y/n >> "
read WANTHISTC

if [[ ${WANTHISTC} == y ]]; then
    echo -e ""
    echo -e "What type of History Control do you want?"
    echo -e "erasedups, ignoredups, ignorespace or ignoreboth?"
    echo -e "if you don't know what this is, type: erasedups"
    echo -ne " >> "
    read HISTFM
        if [[ ${HISTFM} == erasedups ]]; then
            echo -e ""
            echo -e "Setting History Control Format to: erasedups"
            echo "HISTCONTROL="erasedups"" >> ${BASHRC}
        elif [[ ${HISTFM} == ignoredups ]]; then
            echo -e ""
            echo -e "Setting History Control Format to: ignoredups"
            echo "HISTCONTROL="ignoredups"" >> ${BASHRC}
        elif [[ ${HISTFM} == ignorespace ]]; then
            echo -e ""
            echo -e "Setting History Control Format to: ignorespace"
            echo "HISTCONTROL="ignorespace"" >> ${BASHRC}
        elif [[ ${HISTFM} == ignoreboth ]]; then
            echo -e ""
            echo -e "Setting History Control Format to: ignoreboth"
            echo -e "HISTCONTROL="ignoreboth"" >> ${BASHRC}
        else echo "you have to type "erasedups", "ignoredups", "ignorespace" or "ignoreboth", exiting" || exit
        fi
else echo "not changing History Control Format"
fi

echo -e ""
echo -e "Do you want to set "CDPATH" [NOT "PATH"]?"
echo -e "if you don't know what this is, type: n"
echo -ne " y/n >> "
read WANTCDP

if [[ ${WANTCDP} == y ]]; then
    echo -e ""
    echo -e "Setting CDPATH to: "~:/usr/src:/usr/share/:/usr/share/icons:/usr/share/themes:/usr/share/icons:/usr/share/""
    echo "CDPATH="~:/usr/src:/usr/share/:/usr/share/icons:/usr/share/themes:/usr/share/icons:/usr/share/"" >> ${BASHRC}
else echo "not enabling CDPATH"
fi

echo -e ""
echo -e "Do you want to enable FIGNORE?"
echo -e "if you don't know what this is, type: n"
echo -ne " y/n >> "
read WANTFI

if [[ ${WANTFI} == y ]]; then
    echo -e ""
    echo -e "Setting FIGNORE to: ".o:.old:.back:.bak:~""
    echo "FIGNORE=".o:.old:.back:.bak:~"" >> ${BASHRC}
else echo "not changing FIGNORE"
fi

echo -e ""
echo -e "Do you want to set editor for the "fc" command?"
echo -ne " y/n >> "
read WANTFC

if [[ ${WANTFC} == y ]]; then
    echo -e ""
    echo -e "Which editor to use? (enter full path)"
    echo -ne " >> "
    read WHATFC
    echo -e ""
    echo -e "Setting FCEDIT"
    echo "FCEDIT="${WHATFC}"" >> ${BASHRC}
else echo "Not Changing FCEDIT"
fi

echo -e ""
echo -e "Do you want to have colored man-pages?"
echo -ne " y/n >> "
read WANTCOLM

if [[ ${WANTCOLM} == y ]]; then
    echo -e ""
    echo -e "Enabling Colored Manpages"
    rm -rf ${HOME}/.terminfo
    mkdir -p ${HOME}/.terminfo
    MOSTPATH="/etc/bash-style/mostlike.txt"
    echo "alias man="TERMINFO=~/.terminfo TERM=mostlike LESS=C PAGER=less man"" >> ${BASHRC}
    tic ${MOSTPATH}
else echo "not enabling colored man-pages"
fi   

echo -e ""
echo -e "Close Terminal and start new one, or type "source ${BASHRC}"n"
echo -e "Eveything should work for now, if not remove the following line from ${HOME}/.bashrc: n"
echo -e ""source ${BASHRC}" and tell me what didn't work n"
echo -e "finished n"

exit
na rażie robię od tego mała przerwe bo łeb mi peękł
Potem dam znac jak dychne od tego gówna


http://img196.imageshack.us/img196/3770/freebsde.jpg

Offline

 

Stopka forum

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson
Nas ludzie lubią po prostu, a nie klikając w przyciski ;-)