Posts tagged Snippet

Bash: Befehl X mal ausfuehren

1
2
3
4
for i in {1..10}
do
  echo "Welcome $i times!"
done

Falls ich das wieder vergessen sollte. Wichtig: GESCHWUNGENE Klammern!

Nachtrag auf Anfrage:
Der Einzeiler sieht dann so aus:
for i in {1..10}; do echo "Welcome $i times!"; echo "Noch ein Befehl"; done

SVN: Revisionen rückgängig machen

Wenn man so rumbastelt wie ich, kann es schon mal vorkommen dass man Sachen eincheckt, die man dann später wieder bereut.

Um nun eine gesamte Revision rückgängig zu machen, ist wie folgt vorzugehen (Mal angenommen, ich will r13 rückgängig machen):

1
2
3
4
$ svn merge -c -13 http://example.com/repo/trunk
# Dadurch wird das Changeset von r13 rückwärts angewendet
$
$ svn commit -m 'Undoing changes commited in r13'

Eh voila!

Gefunden in den Common Use-Cases im SVN-Book

Linux/Unix: Ordner rekursiv durchsuchen und Files löschen

1
find . -name .svn -type d -exec rm -r "{}" \;

Auszug aus

1
man find

:

1
2
-exec utility [argument ...] ;
True if the program named utility returns a zero value as its exit status.  Optional arguments may be passed to the utility.  The expression must be terminated by a semicolon (``;'').  If you invoke find from a shell you may need to quote the semicolon if the shell would otherwise treat it as a control operator.  If the string ``{}'' appears anywhere in the utility name or the arguments it is replaced by the pathname of the current file. Utility will be executed from the directory from which find was executed.  Utility and arguments are not subject to the further expansion of shell patterns and constructs.

PHP ‘and’

Wieder was gelernt:

<?php
$foo = true;
$bar = false;
$foo and print 'fuuuu';
$bar and print 'baaar';
?>

Ergibt “fuuuu”!

Klappt zwar mit print, nicht jedoch mit echo!