Skip to main content
Rollback to Revision 2
Source Link
slhck
  • 230.2k
  • 71
  • 621
  • 603

On most distributions you can use tee:

echo "task goes here" | cat - todo.txt | tee todo.txt

An alternative isThe moreutils which have a nice tool called sponge:

echo "task goes here" | cat - todo.txt | sponge todo.txt

tee and sponge will It'll "soak up" STDIN and then write to the file, which means you don't have to worry about temporary files and moving them around.

You can get moreutils with many Linux distros, through apt-get install moreutils, or on OS X using Homebrew, with brew install moreutils.

On most distributions you can use tee:

echo "task goes here" | cat - todo.txt | tee todo.txt

An alternative is moreutils which have a nice tool called sponge:

echo "task goes here" | cat - todo.txt | sponge todo.txt

tee and sponge will "soak up" STDIN and then write to the file, which means you don't have to worry about temporary files and moving them around.

You can get moreutils with many Linux distros, through apt-get install moreutils, or on OS X using Homebrew, with brew install moreutils.

The moreutils have a nice tool called sponge:

echo "task goes here" | cat - todo.txt | sponge todo.txt

It'll "soak up" STDIN and then write to the file, which means you don't have to worry about temporary files and moving them around.

You can get moreutils with many Linux distros, through apt-get install moreutils, or on OS X using Homebrew, with brew install moreutils.

added 143 characters in body
Source Link
slhck
  • 230.2k
  • 71
  • 621
  • 603

TheOn most distributions you can use tee:

echo "task goes here" | cat - todo.txt | tee todo.txt

An alternative is moreutils which have a nice tool called sponge:

echo "task goes here" | cat - todo.txt | sponge todo.txt

It'lltee and sponge will "soak up" STDIN and then write to the file, which means you don't have to worry about temporary files and moving them around.

You can get moreutils with many Linux distros, through apt-get install moreutils, or on OS X using Homebrew, with brew install moreutils.

The moreutils have a nice tool called sponge:

echo "task goes here" | cat - todo.txt | sponge todo.txt

It'll "soak up" STDIN and then write to the file, which means you don't have to worry about temporary files and moving them around.

You can get moreutils with many Linux distros, through apt-get install moreutils, or on OS X using Homebrew, with brew install moreutils.

On most distributions you can use tee:

echo "task goes here" | cat - todo.txt | tee todo.txt

An alternative is moreutils which have a nice tool called sponge:

echo "task goes here" | cat - todo.txt | sponge todo.txt

tee and sponge will "soak up" STDIN and then write to the file, which means you don't have to worry about temporary files and moving them around.

You can get moreutils with many Linux distros, through apt-get install moreutils, or on OS X using Homebrew, with brew install moreutils.

added 176 characters in body
Source Link
slhck
  • 230.2k
  • 71
  • 621
  • 603

The moreutils have a nice tool called sponge:

echo "task goes here" | cat - todo.txt | sponge todo.txt

It'll "soak up" STDIN and then write to the file, which means you don't have to worry about temporary files and moving them around.

You can get moreutils with many Linux distros, through apt-get install moreutils, or on OS X using Homebrew, with brew install moreutils.

The moreutils have a nice tool called sponge:

echo "task goes here" | cat - todo.txt | sponge todo.txt

It'll "soak up" STDIN and then write to the file, which means you don't have to worry about temporary files and moving them around.

The moreutils have a nice tool called sponge:

echo "task goes here" | cat - todo.txt | sponge todo.txt

It'll "soak up" STDIN and then write to the file, which means you don't have to worry about temporary files and moving them around.

You can get moreutils with many Linux distros, through apt-get install moreutils, or on OS X using Homebrew, with brew install moreutils.

Source Link
slhck
  • 230.2k
  • 71
  • 621
  • 603
Loading