View previous topic :: View next topic |
Author |
Message |
paolo l33t
Joined: 23 Jul 2002 Posts: 768 Location: SBT (AP)
|
Posted: Mon Aug 11, 2003 11:28 pm Post subject: [TIP] Bash-completion |
|
|
Koma mi ha fatto venire l'idea del tip, di metterne uno ogni tanto
Conoscete la bash-completion?
Il sito web è questo.
In pratica è uno script (in bash!) che potenzia la completion che già ha la bash e cioè quella feature che vi permette di "completare" la digitazione di un nome file semplicemente premendo il tasto TAB.
Con questo script avrete la completion anche con il comando "emerge" (vi completerà la sezione e il nome pacchetto, con i comandi modprobe, e tanti altri!
E' di una utilità unica.
Io la trovo indispensabile, soprattutto perchè uso quasi esclusivamente la console. Ma... chi da X non apre una, due, tre shell?
fate Code: | emerge bash-completion |
modificate quello che c'è da modificare (i modi per farla funzionare sono diversi) e divertitevi a sfruttare la potenza di questo tool.
ByEZz,
Paolo _________________ Nihil sine magno labore |
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 30925 Location: here
|
Posted: Mon Aug 11, 2003 11:36 pm Post subject: |
|
|
E la prima cosa che scarico quando ho finito di fare emerge system. E' l'utility che uso di piu' in assoluto. _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
MyZelF Bodhisattva
Joined: 25 Feb 2003 Posts: 2010 Location: Venice, Italy
|
Posted: Tue Aug 12, 2003 3:28 am Post subject: |
|
|
eccezionale... ottimo tip! |
|
Back to top |
|
|
bubble27 Guru
Joined: 07 Aug 2003 Posts: 365 Location: Campobasso
|
Posted: Tue Aug 12, 2003 9:46 am Post subject: |
|
|
ecco a cosa si riferisce l'ultima riga del file .bashrc .....
##uncomment the following to activate bash-completion:
#[ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion |
|
Back to top |
|
|
bsolar Bodhisattva
Joined: 12 Jan 2003 Posts: 2764
|
Posted: Tue Aug 12, 2003 9:58 am Post subject: |
|
|
Non sarebbe più conveniente mettere tutti i TIP in una thread unica che fa da elenco con un link ad un'altra (o altre) thread per la discussione?
Lascio la palla a cerri... _________________ I may not agree with what you say, but I'll defend to the death your right to say it. |
|
Back to top |
|
|
cerri Bodhisattva
Joined: 05 Mar 2003 Posts: 2957 Location: # init S
|
Posted: Tue Aug 12, 2003 10:17 am Post subject: |
|
|
Giuro, ci avevo pensato ma mi sono detto...
mente di cerri wrote: | naaaaaaa sarebbe bello ma se apro un altro sticky qui mi cacciano.... |
_________________ Enjoy your freedom.
Sex is like hacking. You get in, you get out, and you hope you didnt leave something behind that can be traced back to you.
<----------------------->
Andrea Cerrito |
|
Back to top |
|
|
xlyz Veteran
Joined: 27 Oct 2002 Posts: 1470 Location: Italy
|
Posted: Tue Aug 12, 2003 10:29 am Post subject: |
|
|
cerri wrote: | Giuro, ci avevo pensato ma mi sono detto...
mente di cerri wrote: | naaaaaaa sarebbe bello ma se apro un altro sticky qui mi cacciano.... |
|
anche perchè non vorrei dover scrollare tutta la pagina per arrivare ai post non sticky |
|
Back to top |
|
|
shev Bodhisattva
Joined: 03 Feb 2003 Posts: 4084 Location: Italy
|
Posted: Thu Aug 14, 2003 11:21 am Post subject: |
|
|
Ottimo il tips di Paolo.
Ricordo che sul sito gentoo.it raccogliamo nella sezione Tips&Tricks cose del genere, quindi oltre che a mettere giustamente il tutto in un topic apposito in questo forum, se qualche volenteroso volesse scrivere brevi howto anche per il sito sarebbe una gran cosa (io ovviamente sono disponibile, però mi pare giusto che ognuno metta a suo nome i suoi tips & tricks). |
|
Back to top |
|
|
Rotterdam n00b
Joined: 14 Nov 2003 Posts: 22 Location: Core Dump
|
Posted: Fri Nov 14, 2003 9:18 am Post subject: |
|
|
ma una volta emergiato e decomentata la riga nel .bashrc cosa bisogna fare? _________________ Core Dump |
|
Back to top |
|
|
micron Guru
Joined: 23 Jul 2003 Posts: 411 Location: Bergamo, Italy
|
Posted: Fri Nov 14, 2003 9:24 am Post subject: |
|
|
Mitico!! corro a provarlo, grande tip!! _________________ ~ "Progress is merely a realisation of utopias" ~ |
|
Back to top |
|
|
possi n00b
Joined: 07 Nov 2003 Posts: 26
|
Posted: Wed Sep 01, 2004 1:58 am Post subject: |
|
|
Rotterdam wrote: | ma una volta emergiato e decomentata la riga nel .bashrc cosa bisogna fare? |
premere il TAB |
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 30925 Location: here
|
Posted: Wed Sep 01, 2004 5:15 am Post subject: |
|
|
possi wrote: | Rotterdam wrote: | ma una volta emergiato e decomentata la riga nel .bashrc cosa bisogna fare? |
premere il TAB |
Hai visto la data del messaggio di Rotterdam _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
possi n00b
Joined: 07 Nov 2003 Posts: 26
|
Posted: Wed Sep 01, 2004 10:28 am Post subject: |
|
|
fedeliallalinea wrote: | possi wrote: | Rotterdam wrote: | ma una volta emergiato e decomentata la riga nel .bashrc cosa bisogna fare? |
premere il TAB |
Hai visto la data del messaggio di Rotterdam |
hemmm... |
|
Back to top |
|
|
mambro l33t
Joined: 22 Mar 2004 Posts: 752 Location: Mira (VE) - Italy
|
Posted: Sun Oct 03, 2004 9:23 pm Post subject: |
|
|
Meglio tardi che mai
Cmq a me funziona da utente ma da root non va... ho copiato il .bashrc che ho nella mia home in /root/.bashrc ma pare che root nn carichi quel file Cosa sbaglio? _________________ "The design of a worldwide, fully transparent distributed file system for simultaneous use by millions of mobile and frequently disconnected users is left as an excercise for the reader".
Andrew S. Tanenbaum, Distributed Operating Systems. |
|
Back to top |
|
|
gutter Bodhisattva
Joined: 13 Mar 2004 Posts: 7162 Location: Aarau, Aargau, Switzerland
|
Posted: Sun Oct 03, 2004 9:25 pm Post subject: |
|
|
mambro wrote: | Meglio tardi che mai
Cmq a me funziona da utente ma da root non va... ho copiato il .bashrc che ho nella mia home in /root/.bashrc ma pare che root nn carichi quel file Cosa sbaglio? |
Copia anche il /etc/skel/.bash_profile in /root e riprova vedrai che funge. _________________ Registered as User #281564 and Machines #163761 |
|
Back to top |
|
|
n3m0 l33t
Joined: 08 Feb 2004 Posts: 798 Location: Richville, Naples, Italy, Europe
|
Posted: Sun Oct 03, 2004 9:45 pm Post subject: |
|
|
E' del file /etc/inputrc che mi dite?
Non so come sia fatto quello di default di gentoo, perche' la prima cosa che ho fatto quandoi ho installato gentoo è mettere la MIA copia di inputrc, gentilmente concesso da SuSE (me lo porto dietro dai tempi in cui provai SuSE 8 ).
Con il seguente inputrc, aggiungere nuove funzionalita' alla bash, come la comodissima history prefix based (ma anche altre, a voi il piacere di scropirle)
Es:
Code: |
# mpla <PG_UP>
# mplayer pippo.avi <PG_UP>
# mplayer pluto.avi
|
e così via...
Se questo inputrc risulta essere un tip (nel senso che quello di default di Gentoo non permette queste operazioni) allora ditemelo che lo metto in un topic a parte.
Ecco il file.
Code: | ################################################################################
## /etc/inputrc
##
## Attempt to put different TERMs together in one readline init file.
## Copyright (c) 1997,2000 SuSE Linux AG, Nuernberg, Germany.
##
## Author: Werner Fink, <werner@suse.de>
##
################################################################################
#
# Eight bit compatible: Umlaute
#
set meta-flag on
set output-meta on
set convert-meta off
set term xy
#
# VI line editing
#
$if mode=vi
set editing-mode vi
set keymap vi
$endif
#
# Common standard keypad and cursor
#
"\e[1~": beginning-of-line
"\e[2~": yank
"\e[3~": delete-char
"\e[4~": end-of-line
"\e[5~": history-search-backward
"\e[6~": history-search-forward
$if term=xterm
"\e[2;5~": yank
"\e[3;5~": delete-char
"\e[5;5~": history-search-backward
"\e[6;5~": history-search-forward
$endif
"\e[C": forward-char
"\e[D": backward-char
"\e[A": previous-history
"\e[B": next-history
$if term=xterm
"\e[E": re-read-init-file
$else
"\e[G": re-read-init-file
$endif
#
# Avoid network problems
# ... \177 (ASCII-DEL) and \010 (ASCII-BS)
# do `backward-delete-char'
# Note: `delete-char' is maped to \033[3~
# Therefore xterm's responce on pressing
# key Delete or KP-Delete should be
# \033[3~ ... NOT \177
#
"\C-?": backward-delete-char
"\C-H": backward-delete-char
#
# Home and End
#
$if term=xterm
#
# Normal keypad and cursor of xterm
#
"\e[1~": history-search-backward
"\e[4~": set-mark
"\e[H": beginning-of-line
"\e[F": end-of-line
# Home and End of application keypad and cursor of xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
"\eO5H": beginning-of-line
"\eO5F": end-of-line
$else
$if term=kvt
"\e[1~": history-search-backward
"\e[4~": set-mark
"\eOH": beginning-of-line
"\eOF": end-of-line
$endif
#
# TERM=linux or console or gnome
#
"\e[1~": beginning-of-line
"\e[4~": end-of-line
$endif
#
# Application keypad and cursor of xterm
#
$if term=xterm
"\eOD": backward-char
"\eOC": forward-char
"\eOA": previous-history
"\eOB": next-history
"\eOE": re-read-init-file
# DEC keyboard KP_F1 - KP_F4 or
# XTerm of XFree86 in VT220 mode F1 - F4
"\eOP": prefix-meta
"\eOQ": undo
"\eOR": ""
"\eOS": kill-line
$endif
$if term=gnome
# or gnome terminal F1 - F4
"\eOP": prefix-meta
"\eOQ": undo
"\eOR": ""
"\eOS": kill-line
$endif
#
# Function keys F1 - F12
#
$if term=linux
#
# On console the first five function keys
#
"\e[[A": prefix-meta
"\e[[B": undo
"\e[[C": ""
"\e[[D": kill-line
"\e[[E": ""
$else
#
# The first five standard function keys
#
"\e[11~": prefix-meta
"\e[12~": undo
"\e[13~": ""
"\e[14~": kill-line
"\e[15~": ""
$endif
"\e[17~": ""
"\e[18~": ""
"\e[19~": ""
"\e[20~": ""
"\e[21~": ""
# Note: F11, F12 are identical with Shift_F1 and Shift_F2
"\e[23~": ""
"\e[24~": ""
#
# Shift Function keys F1 - F12
# identical with F11 - F22
#
#"\e[23~": ""
#"\e[24~": ""
"\e[25~": ""
"\e[26~": ""
# DEC keyboard: F15=\e[28~ is Help
"\e[28~": ""
# DEC keyboard: F16=\e[29~ is Menu
"\e[29~": ""
"\e[31~": ""
"\e[32~": ""
"\e[33~": ""
"\e[34~": ""
$if term=xterm
# Not common
"\e[35~": ""
"\e[36~": ""
$endif
#
$if term=xterm
#
# Application keypad and cursor of xterm
# with NumLock ON
#
# Operators
"\eOo": "/"
"\eOj": "*"
"\eOm": "-"
"\eOk": "+"
"\eOl": ","
"\eOM": accept-line
"\eOn": "."
# Numbers
"\eOp": "0"
"\eOq": "1"
"\eOr": "2"
"\eOs": "3"
"\eOt": "4"
"\eOu": "5"
"\eOv": "6"
"\eOw": "7"
"\eOx": "8"
"\eOy": "9"
$endif
#
# EMACS line editing
#
$if mode=emacs
#
# ... xterm application cursor
#
$if term=xterm
"\e\eOD": backward-word
"\e\eOC": forward-word
"\e\eOA": up-history
"\e\eOB": down-history
"\C-\eOD": backward-char
"\C-\eOC": forward-char
"\C-\eOA": up-history
"\C-\eOB": down-history
$endif
#
# Standard cursor
#
"\e\e[D": backward-word
"\e\e[C": forward-word
"\e\e[A": up-history
"\e\e[B": down-history
"\C-\e[D": backward-char
"\C-\e[C": forward-char
"\C-\e[A": up-history
"\C-\e[B": down-history
$endif
#
# end
#
|
_________________ Lenergia è la civiltà. Lasciarla in mano ai piromani/petrolieri è criminale. Perché aspettare che finisca il petrolio?
Letà della pietra non è mica finita per mancanza di pietre. - B.G.
Site/Blog: http://www.neminis.org |
|
Back to top |
|
|
mambro l33t
Joined: 22 Mar 2004 Posts: 752 Location: Mira (VE) - Italy
|
Posted: Mon Oct 04, 2004 12:28 pm Post subject: |
|
|
gutter wrote: | mambro wrote: | Meglio tardi che mai
Cmq a me funziona da utente ma da root non va... ho copiato il .bashrc che ho nella mia home in /root/.bashrc ma pare che root nn carichi quel file Cosa sbaglio? |
Copia anche il /etc/skel/.bash_profile in /root e riprova vedrai che funge. |
Ora va, grazie mille _________________ "The design of a worldwide, fully transparent distributed file system for simultaneous use by millions of mobile and frequently disconnected users is left as an excercise for the reader".
Andrew S. Tanenbaum, Distributed Operating Systems. |
|
Back to top |
|
|
gutter Bodhisattva
Joined: 13 Mar 2004 Posts: 7162 Location: Aarau, Aargau, Switzerland
|
Posted: Mon Oct 04, 2004 1:38 pm Post subject: |
|
|
mambro wrote: |
Ora va, grazie mille |
Di niente _________________ Registered as User #281564 and Machines #163761 |
|
Back to top |
|
|
xoen Guru
Joined: 06 Sep 2003 Posts: 472 Location: /dev/null
|
Posted: Sun Nov 28, 2004 9:03 am Post subject: Re: [TIP] Bash-completion |
|
|
paolo wrote: | Con questo script avrete la completion anche con il comando "emerge" (vi completerà la sezione e il nome pacchetto, con i comandi modprobe, e tanti altri! |
Deng Iu... _________________ xoen.Blog()
god@paradise # tar xfvjp big-bang.tar.bz2 -C universe |
|
Back to top |
|
|
SilverXXX l33t
Joined: 18 Sep 2004 Posts: 885
|
Posted: Sun Nov 28, 2004 9:33 am Post subject: |
|
|
fantastico ! Cosa mi ero perso, finora. _________________ about:mozilla |
|
Back to top |
|
|
lavish Bodhisattva
Joined: 13 Sep 2004 Posts: 4296
|
|
Back to top |
|
|
Giepi Apprentice
Joined: 29 Sep 2004 Posts: 164 Location: Non pallo, io!
|
Posted: Tue Nov 30, 2004 2:51 pm Post subject: |
|
|
non riesco attivarlo su root.
non esiste /root/.bashrc e /etc/skel è vuota
se in /root/bashrc metto solo la stringa che da sul sito o quella che me la fa girare nel mio utente "normale" non va the same _________________ I SEE THE FLASH! THE FLAAASH!
AND YOU INFEDEL WILL DIE!!!
SLEEEPEEER AWAAAKEE!!!
* allucinato * |
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 30925 Location: here
|
Posted: Tue Nov 30, 2004 2:52 pm Post subject: |
|
|
Io metto la riga in /etc/profile _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
gutter Bodhisattva
Joined: 13 Mar 2004 Posts: 7162 Location: Aarau, Aargau, Switzerland
|
Posted: Tue Nov 30, 2004 3:35 pm Post subject: |
|
|
fedeliallalinea wrote: | Io metto la riga in /etc/profile |
@Giepi: Almeno così la setti pet tutti e ti togli il pensiero _________________ Registered as User #281564 and Machines #163761 |
|
Back to top |
|
|
stefanonafets l33t
Joined: 10 Feb 2003 Posts: 644
|
Posted: Tue Nov 30, 2004 3:59 pm Post subject: |
|
|
Quote: | wowowowow! MITTICO! E io che nn ne sapevo ancora nulla... |
Su non-mi-ricordo-quale guida c'era scritta una roba del tipo "Bash ha un casino di parti oscure, e la gente tende ad usarle tutte..."
(scusate per la simil-citazione abbastanza imprecisa, spero che qualcuno possa correggere e/o migliorare...) _________________ registered Linux user number #411324
sed 's/ke/che/g'
<The Deployment Slave is initializing> |
|
Back to top |
|
|
|