ReproNim / containers

Containers "distribution" for reproducible neuroimaging
Apache License 2.0
26 stars 16 forks source link

scripts/freeze_containers - provide workaround for absent sed -i on OSX #36

Closed yarikoptic closed 4 years ago

yarikoptic commented 4 years ago

here is what we did in https://github.com/ReproNim/simple_workflow/blob/b4ea4a902abd92852328f55a26eb45ab049d458c/Simple_Prep_docker#L19

# a little helper since sed on OSX does not have sed -i
# for in-place modifications.  Note that filename here comes first
# just to ease scripting
sed-i () {
  filename=$1
  tfilename=$(mktemp -t sed_replace.XXXXXXXXX)
  shift
  sed "$@" "$filename" >| "$tfilename"
  mv "$tfilename" "$filename"
}