This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bash Scripting - Quoting | |
Chiunque abbia usato seriamente la Bash si è scontrato almeno una volta (e probabilmente più di una) con problemi legati al quoting. | |
Uno dei problemi più comuni è la difficoltà nello script che non riescono a gestire casi in teoria semplici come i file con uno spazio nel nome. Quasi come se fosse impossibile gestire dei file con nomi di quel tipo. | |
In realtà, anche se quasi nessuno sa come, con la Shell è possibile gestire file con nomi contenenti praticamente qualsiasi cosa. Per come è fatta Bash è possibile lavorare con qualsiasi nome di file che il kernel sia in grado di gestire. Quindi, ammesso di conoscere bene le regole del quoting, si può lavorare con problemi sia con i file con nomi contenenti spazi, sia pure con file con nomi contententi le più strane sequenze unicode (dagli emoji della birra a pure alle sequenze unicode non ancora definite nello standard). | |
Il quoting della shell, se usato correttamente, permette di gestire qualsiasi nome di file. Molti trovano difficolt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find the modules/folders with highest number of changes | |
git rev-list --objects --all | awk '$2' | sort -k2 | uniq -cf1 | sort -rn | head | |
# find the files with the highest number of changes | |
git rev-list --objects --all | awk '$2' | sort -k2 | uniq -cf1 | sort -rn | | |
while read frequency sample path | |
do | |
[ "blob" == "$(git cat-file -t $sample)" ] && echo "$frequency\t$path"; | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
Person = Struct.new(:name, :email) do | |
def activate | |
`git config user.name '#{name}'` | |
`git config user.email '#{email}'` | |
end | |
end |