linux:bash
Rozdíly
Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.
| Následující verze | Předchozí verze | ||
| linux:bash [2016/04/13 16:10] – upraveno mimo DokuWiki 127.0.0.1 | linux:bash [2020/06/01 21:05] (aktuální) – [KEEP 2 LAST NEW SUBDIRECTORIES] added note on head usage nost23 | ||
|---|---|---|---|
| Řádek 51: | Řádek 51: | ||
| $ exit 0-255[int, | $ exit 0-255[int, | ||
| </ | </ | ||
| + | |||
| + | ===== KEEP 2 LAST NEW SUBDIRECTORIES ===== | ||
| + | <code bash> | ||
| + | find /tmp -maxdepth 1 -mindepth 1 -type d -printf '%T@ %p\n' | sort -nk1| head -n -2| cut -d\\ -f2- | ||
| + | </ | ||
| + | |||
| + | <WRAP info> | ||
| + | NOTE: // | ||
| + | < | ||
| + | find /tmp -maxdepth 1 -mindepth 1 ... | ||
| + | </ | ||
| + | |||
| + | It's kinda hack to get rid of parent directory [ "/ | ||
| + | </ | ||
| + | |||
| + | <WRAP info> | ||
| + | NOTE: usage of //head// instead of //tail// | ||
| + | < | ||
| + | head -n -2 | ||
| + | </ | ||
| + | this way we keep always 2 in case of less subdirectories. | ||
| + | </ | ||
linux/bash.1460563821.txt.gz · Poslední úprava: 2016/04/13 16:10 autor: 127.0.0.1