Uživatelské nástroje

Nástroje pro tento web


linux:bash

Rozdíly

Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.

Odkaz na výstup diff

Následující verze
Předchozí verze
linux:bash [2016/04/13 16:10] – upraveno mimo DokuWiki 127.0.0.1linux: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,0=success] $ exit 0-255[int,0=success]
 </code> </code>
 +
 +===== 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-
 +</code>
 +
 +<WRAP info>
 +NOTE: //maxdepth// and //mindepth// in
 +<code>
 +find /tmp -maxdepth 1 -mindepth 1 ...
 +</code>
 +
 +It's kinda hack to get rid of parent directory [ "/tmp" here ].
 +</WRAP>
 +
 +<WRAP info>
 +NOTE: usage of //head// instead of //tail//
 +<code>
 +head -n -2
 +</code>
 +this way we keep always 2 in case of less subdirectories.
 +</WRAP>
linux/bash.1460563821.txt.gz · Poslední úprava: 2016/04/13 16:10 autor: 127.0.0.1