A previous question of mine asked how to pipe downloaded files through tar, now I would like to know how to pipe the output of tar through mv. See I have this command at the moment:
wget -c https://github.com/JeffHoogland/moksha/archive/0.1.0.tar.gz | tar -xz
and this creates a directory called moksha-0.1.0
, but I would like to know how I might rename this output directory as moksha
, perhaps via a pipe (|
) at the end of this command. Although if you know how to do this without a pipe, but still on the same line of code as wget and tar, I will be happy to accept it too.
To be clear I know that:
wget -c https://github.com/JeffHoogland/moksha/archive/0.1.0.tar.gz | tar -xz -C moksha
will create an output directory moksha
but within this output directory there will be the moksha-0.1.0
directory, rather I want to rename this moksha-0.1.0
directory as moksha
, instead of placing moksha-0.1.0
in a new directory called moksha
.
Best Answer
Like this?
From the
tar
manual page:So
sed
is probably required for this to work. Though if you havewget
, you probably havesed
as well.