Another alternative is 'ts' which is part of joey hess's awesome collection of unix tools, moreutils.[1] I did not find out about ts until too late so I am still in the habit of using tai64n from djb's daemontools, which adds a tai64 timestamp to every file[2] and then tai64nlocal[3] in order to convert the timestamps to something useful to humans. If you don't know about moreutils check out the collection. I don't k…
One slightly off-topic note: > ifdata: get network interface info without parsing ifconfi If it's Linux, ifconfig isn't maintained anymore and might actually be lying (eg, virtual IPs on vlans on bonded NICs - sounds exotic but almost every trading house uses this config). Use the 'ip' command for most things you would have done with 'ifconfig'. If it's BSD, ignore that and ifconfig away.
Show HN: now.sh
31–40 of 45 posts
Re: Show HN: now.sh
#32Another alternative is 'ts' which is part of joey hess's awesome collection of unix tools, moreutils.[1] I did not find out about ts until too late so I am still in the habit of using tai64n from djb's daemontools, which adds a tai64 timestamp to every file[2] and then tai64nlocal[3] in order to convert the timestamps to something useful to humans. If you don't know about moreutils check out the collection. I don't k…
> sponge: soak up standard input and write to a file Whoa! No kidding? I wrote a program years ago, probably around 2005, also called sponge, that does exactly this[1]. I'm not sure how to feel about this. Obviously the idea was a good one, but it's equally obvious I suck at getting the word out about my creations. [1] https://github.com/graue/graue-utils/blob/master/sponge.c
Re: Show HN: now.sh
#33Earlier quoted context omitted.
> sponge: soak up standard input and write to a file Whoa! No kidding? I wrote a program years ago, probably around 2005, also called sponge, that does exactly this[1]. I'm not sure how to feel about this. Obviously the idea was a good one, but it's equally obvious I suck at getting the word out about my creations. [1] https://github.com/graue/graue-utils/blob/master/sponge.c
In the "Unix Programming Environment" book from 1984 there is an "overwrite" shell script depicted that does exactly this. I wonder why this never made it into the standard UNIX toolkit.
That can be said for so many of these programs.
Re: Show HN: now.sh
#34I'm not sure I really see a point in this. How are you going to forget the server's time zone when it's listed in the timestamps? It doesn't really make sense.
Re: Show HN: now.sh
#35Another alternative is 'ts' which is part of joey hess's awesome collection of unix tools, moreutils.[1] I did not find out about ts until too late so I am still in the habit of using tai64n from djb's daemontools, which adds a tai64 timestamp to every file[2] and then tai64nlocal[3] in order to convert the timestamps to something useful to humans. If you don't know about moreutils check out the collection. I don't k…
One slightly off-topic note: > ifdata: get network interface info without parsing ifconfi If it's Linux, ifconfig isn't maintained anymore and might actually be lying (eg, virtual IPs on vlans on bonded NICs - sounds exotic but almost every trading house uses this config). Use the 'ip' command for most things you would have done with 'ifconfig'. If it's BSD, ignore that and ifconfig away.
It's about as bad as Solaris with their ifconfig/ipadm stuff and changing everything around so that configuration exists in multiple places and one tool doesn't handle the other. ipadm doesn't properly deal with /etc/. files and the two will conflict. Ugh.
Re: Show HN: now.sh
#36Earlier quoted context omitted.
One slightly off-topic note: > ifdata: get network interface info without parsing ifconfi If it's Linux, ifconfig isn't maintained anymore and might actually be lying (eg, virtual IPs on vlans on bonded NICs - sounds exotic but almost every trading house uses this config). Use the 'ip' command for most things you would have done with 'ifconfig'. If it's BSD, ignore that and ifconfig away.
Thank god for the Linux people innovating and replacing a perfectly functional tool that could be properly extended to add support for that configuration, and instead requiring people to learn yet another command. It's about as bad as Solaris with their ifconfig/ipadm stuff and changing everything around so that configuration exists in multiple places and one tool doesn't handle the other. ipadm doesn't properly deal…
Re: Show HN: now.sh
#37Two comments: 1) Really? This is on the front page of HN? 2) why aren't you printing to stderr?
Re: Show HN: now.sh
#38Another alternative is 'ts' which is part of joey hess's awesome collection of unix tools, moreutils.[1] I did not find out about ts until too late so I am still in the habit of using tai64n from djb's daemontools, which adds a tai64 timestamp to every file[2] and then tai64nlocal[3] in order to convert the timestamps to something useful to humans. If you don't know about moreutils check out the collection. I don't k…
> sponge: soak up standard input and write to a file Whoa! No kidding? I wrote a program years ago, probably around 2005, also called sponge, that does exactly this[1]. I'm not sure how to feel about this. Obviously the idea was a good one, but it's equally obvious I suck at getting the word out about my creations. [1] https://github.com/graue/graue-utils/blob/master/sponge.c
cat output.txt
some
input
EOFRe: Show HN: now.sh
#39Earlier quoted context omitted.
> sponge: soak up standard input and write to a file Whoa! No kidding? I wrote a program years ago, probably around 2005, also called sponge, that does exactly this[1]. I'm not sure how to feel about this. Obviously the idea was a good one, but it's equally obvious I suck at getting the word out about my creations. [1] https://github.com/graue/graue-utils/blob/master/sponge.c
Just to be a smartarse ;): cat output.txt some input EOF
joeyh's example:
sed "s/root/toor/" /etc/passwd | grep -v joey | sponge /etc/passwd
My example: sort Re: Show HN: now.sh
#40Earlier quoted context omitted.
Just to be a smartarse ;): cat output.txt some input EOF
Maybe I'm missing it, but this doesn't seem applicable to what my sponge program (and joeyh's) are intended to do: to modify a file "in-place". joeyh's example: sed "s/root/toor/" /etc/passwd | grep -v joey | sponge /etc/passwd My example: sort
If the pipe is an unfulfilled promise (no concurrency) then there's no problem. But if the pipe does what it's designed to do, you will lose the file.