4 ms·
Because I can can never remember to use pigz I have to have this in my dotfiles: function ccm() { tar -cf - $1 | pigz > $1.tar.gz }
by vr46 3y ago
Because I can can never remember to use pigz I have to have this in my dotfiles:
function ccm() {
tar -cf - $1 | pigz > $1.tar.gz
}
- mmh0000 3y agoGood thing you never use file names with spaces ;)
- mmh0000 3y agoOkay, I feel that my first response was too snarky. I'm sorry. In its place, I'll say: You wouldn't go outside without pants. You shouldn't use a variable without quotes. Put pants on all variables. Also, you shouldn't use () with 'function' it "works" in Bash but it's not standard: ccm() { tar c "${1}" | pigz > "${1}.tar.gz" } You could further improve it with a loop to accept multiple files: ccm() { for i in $@; do tar c "${i}" | pigz > "${i}.tar.gz" done } Now you can run it like: `ccm file1 file2 file3` See: https://mywiki.wooledge.org/Quotes https://mywiki.wooledge.org/Quotes See: https://mywiki.wooledge.org/BashGuide/CompoundCommands#Functions https://mywiki.wooledge.org/BashGuide/CompoundCommands#Funct...