Skip to content

Instantly share code, notes, and snippets.

@realeroberto
Created February 16, 2018 16:56
Show Gist options
  • Save realeroberto/e659c55f9f9987d34a63ebcdf5a8bddb to your computer and use it in GitHub Desktop.
Save realeroberto/e659c55f9f9987d34a63ebcdf5a8bddb to your computer and use it in GitHub Desktop.
Create a tarball from inside a folder
#!/bin/sh
# create a tarball from inside a folder
dirname=$(cat PROJECT)-$(cat VERSION)
tarball=${dirname}.tar.gz
# avoid tar's error message ``file changed as we read it''
touch "$tarball"
tar cfz "$tarball" \
--transform "s,^\./,$dirname/," \
--exclude=.svn --exclude="$tarball" \
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment