Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

License #7

Open
0mp opened this issue Apr 3, 2022 · 1 comment
Open

License #7

0mp opened this issue Apr 3, 2022 · 1 comment

Comments

@0mp
Copy link

0mp commented Apr 3, 2022

What is the inplace's license? I couldn't find any mention if this little program is open-source or not.

@milahu
Copy link

milahu commented Jun 13, 2022

this little program

its so simple i can write it in 10 lines of bash

#!/bin/sh
# inplace.sh
# Stream editor adaptor for in-place editing
# based on https://github.com/nicowilliams/inplace
# example use:
# $ inplace somefile sed -e 's/foo/bar/g'
# license: MIT. copyright (c) 2022 Milan Hauth
set -e
#set -x # debug
[ "$#" = 0 ] && { echo "inplace: usage: inplace [-b .bak] file.txt sed 's/a/b/'" >&2; exit 1; }
b=""; if [ "$1" = "-b" ]; then shift; b="$1"; shift; fi
f="$1"; shift
[ -n "$1" ] || { echo "inplace: missing argument: command" >&2; exit 1; }
t=$(mktemp)
# command is in $@
cat "$f" | "$@" >"$t" || { rc=$?; echo "inplace: command failed" >&2; exit $rc; }
[ -n "$b" ] && printf "inplace: backup " >&2; cp -v "$f" "$f$b" >&2
mv "$t" "$f"
$ ./inplace.sh -b .bak foo.txt sed 's/a/b/' 
inplace: backup 'foo.txt' -> 'foo.txt.bak'

stuff like this should not even qualify for copyright, should be public domain by default

maybe ask moreutils to implement inplace (moreutils also has sponge)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants