Portál AbcLinuxu, 16. července 2025 09:11


Dotaz: Bash: read a doplňování

David Watzke avatar 15.3.2006 05:49 David Watzke | skóre: 74 | blog: Blog... | Praha
Bash: read a doplňování
Přečteno: 566×
Odpovědět | Admin
Ahoj. Existuje něco jako read, co doplňuje cesty? Občas bych potřeboval do skriptů - je nuda psát to bez doplňování, navíc to zdržuje a není to efektivní :-) Dopodá to potom takhle:
$ read i
/et     po      pa      k
“Being honest may not get you a lot of friends but it’ll always get you the right ones” ―John Lennon
Nástroje: Začni sledovat (2) ?Zašle upozornění na váš email při vložení nového komentáře.

Odpovědi

15.3.2006 08:17 Michal Karas | skóre: 45 | blog: /dev/random
Rozbalit Rozbalit vše Re: Bash: read a doplňování
Odpovědět | | Sbalit | Link | Blokovat | Admin
Myslíš něco jako ve Vimu CTRL-X CTRL-F?
15.3.2006 08:46 Michal Karas | skóre: 45 | blog: /dev/random
Rozbalit Rozbalit vše Re: Bash: read a doplňování
Jo aha, teď jsem si to přečetl ještě jednou a konečně mi došlo, co vlastně chceš. Tak nic.
15.3.2006 10:04 Hynek (Pichi) Vychodil | skóre: 43 | blog: Pichi | Brno
Rozbalit Rozbalit vše Re: Bash: read a doplňování
Odpovědět | | Sbalit | Link | Blokovat | Admin
RTFM
       read [-ers] [-u fd] [-t timeout] [-a aname] [-p prompt] [-n nchars] [-d
       delim] [name ...]
              One line is read from the  standard  input,  or  from  the  file
              descriptor  fd supplied as an argument to the -u option, and the
              first word is assigned to the first name, the second word to the
              second  name, and so on, with leftover words and their interven-
              ing separators assigned to the last name.  If  there  are  fewer
              words read from the input stream than names, the remaining names
              are assigned empty values.  The characters in IFS  are  used  to
              split  the  line into words.  The backslash character (\) may be
              used to remove any special meaning for the next  character  read
              and  for line continuation.  Options, if supplied, have the fol-
              lowing meanings:
              -a aname
                     The words are assigned to sequential indices of the array
                     variable aname, starting at 0.  aname is unset before any
                     new  values  are  assigned.   Other  name  arguments  are
                     ignored.
              -d delim
                     The  first  character  of  delim is used to terminate the
                     input line, rather than newline.
              -e     If the standard input is coming from a terminal, readline
                     (see READLINE above) is used to obtain the line.
              -n nchars
                     read  returns after reading nchars characters rather than
                     waiting for a complete line of input.
              -p prompt
                     Display prompt on standard error, without a trailing new-
                     line, before attempting to read any input.  The prompt is
                     displayed only if input is coming from a terminal.
              -r     Backslash does not act as an escape character.  The back-
                     slash  is considered to be part of the line.  In particu-
                     lar, a backslash-newline pair may not be used as  a  line
                     continuation.
              -s     Silent mode.  If input is coming from a terminal, charac-
                     ters are not echoed.
              -t timeout
                     Cause read to time out and return failure if  a  complete
                     line  of  input is not read within timeout seconds.  This
                     option has no effect if read is not  reading  input  from
                     the terminal or a pipe.
              -u fd  Read input from file descriptor fd.

              If no names are supplied, the line read is assigned to the vari-
              able REPLY.  The return code  is  zero,  unless  end-of-file  is
              encountered,  read  times  out, or an invalid file descriptor is
              supplied as the argument to -u.
XML je zbytečný, pomalý, nešikovný balast, znovu vynalézané kolo a ještě ke všemu šišaté, těžké a kýčovitě pomalované.
15.3.2006 10:09 Hynek (Pichi) Vychodil | skóre: 43 | blog: Pichi | Brno
Rozbalit Rozbalit vše Re: Bash: read a doplňování
Tak mám pocit, že poslední dobou je moje nejčastější odpověď RTFM, ale co mám dělat, když lidi kurva zatvrzele odmítají Read This Fuckin Manual!
XML je zbytečný, pomalý, nešikovný balast, znovu vynalézané kolo a ještě ke všemu šišaté, těžké a kýčovitě pomalované.
15.3.2006 11:29 barney
Rozbalit Rozbalit vše Re: Bash: read a doplňování
skúsiť povedať ktorý manuál ? :-)
man bash
/^ *read \[
15.3.2006 11:34 hm
Rozbalit Rozbalit vše Re: Bash: read a doplňování
help read
David Watzke avatar 15.3.2006 14:05 David Watzke | skóre: 74 | blog: Blog... | Praha
Rozbalit Rozbalit vše Re: Bash: read a doplňování
Oops... četl jsem to moc letmo :-( Díky.
read -e variable
je řešení.
“Being honest may not get you a lot of friends but it’ll always get you the right ones” ―John Lennon
15.3.2006 14:14 Hynek (Pichi) Vychodil | skóre: 43 | blog: Pichi | Brno
Rozbalit Rozbalit vše Re: Bash: read a doplňování
I ty Brute :-(
XML je zbytečný, pomalý, nešikovný balast, znovu vynalézané kolo a ještě ke všemu šišaté, těžké a kýčovitě pomalované.
David Watzke avatar 6.5.2006 08:21 David Watzke | skóre: 74 | blog: Blog... | Praha
Rozbalit Rozbalit vše Re: Bash: read a doplňování
Odpovědět | | Sbalit | Link | Blokovat | Admin
Další dotaz ;-) Existuje totéž i pro Perl? Hodilo by se mi doplňování cesty, ale bojím se, že to nejde...
“Being honest may not get you a lot of friends but it’ll always get you the right ones” ―John Lennon

Založit nové vláknoNahoru

Tiskni Sdílej: Linkuj Jaggni to Vybrali.sme.sk Google Del.icio.us Facebook

ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.