I like to make life easy so I wrote a one-line script
for extracting the contents of a tar file. I copied it
into the /bin directory so I can run it from anywhere.
I tried it out in a test directory where I had it, and
where there is a small test tar file. Here is the dialogue
from running it, using both the local script and the one
in /bin:
~/tartest> ls
tarx test.tar.gz
~/tartest> cat tarx
tar -xf $1.tar.gz
~/tartest> cat ~/bin/tarx
tar -xf $1.tar.gz
~/tartest> ./tarx test
~/tartest> ls
tarx test test.tar.gz
~/tartest> del -r test
~/tartest> tarx test
tar (child): test: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Why doesn't it work from bin/ ?
Why doesn't it work from bin/ ?
I like to make life easy so I wrote a one-line script
for extracting the contents of a tar file. I copied it
into the /bin directory so I can run it from anywhere.
I tried it out in a test directory where I had it, and
where there is a small test tar file. Here is the dialogue
from running it, using both the local script and the one
in /bin:
~/tartest> ls
tarx test.tar.gz
~/tartest> cat tarx
tar -xf $1.tar.gz
~/tartest> cat ~/bin/tarx
tar -xf $1.tar.gz
~/tartest> ./tarx test
~/tartest> ls
tarx test test.tar.gz
~/tartest> del -r test
~/tartest> tarx test
tar (child): test: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Why doesn't it work from bin/ ?
db <dieterhansbritz@gmail.com> writes:
I like to make life easy so I wrote a one-line script
for extracting the contents of a tar file. I copied it
into the /bin directory so I can run it from anywhere.
I tried it out in a test directory where I had it, and
where there is a small test tar file. Here is the dialogue
from running it, using both the local script and the one
in /bin:
~/tartest> ls
tarx test.tar.gz
~/tartest> cat tarx
tar -xf $1.tar.gz
~/tartest> cat ~/bin/tarx
tar -xf $1.tar.gz
~/tartest> ./tarx test
~/tartest> ls
tarx test test.tar.gz
~/tartest> del -r test
~/tartest> tarx test
tar (child): test: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Why doesn't it work from bin/ ?
Probably /bin/tarx isn't the same as ./tarx. What does
cat /bin/tarx
show?
Why doesn't it work from bin/ ?
On Sun, 09 Jun 2024 19:12:52 +0000, Robert Heller wrote:
At Sun, 09 Jun 2024 18:22:38 +0100 Richard Kettlewell
<invalid@invalid.invalid> wrote:
db <dieterhansbritz@gmail.com> writes:
I like to make life easy so I wrote a one-line script for extracting
the contents of a tar file. I copied it into the /bin directory so I
can run it from anywhere.
I tried it out in a test directory where I had it, and where there is
a small test tar file. Here is the dialogue from running it, using
both the local script and the one in /bin:
~/tartest> ls tarx test.tar.gz ~/tartest> cat tarx tar -xf $1.tar.gz
~/tartest> cat ~/bin/tarx tar -xf $1.tar.gz ~/tartest> ./tarx test
~/tartest> ls tarx test test.tar.gz ~/tartest> del -r test
~/tartest> tarx test tar (child): test: Cannot open: No such file or
directory tar (child): Error is not recoverable: exiting now tar:
Child returned status 2 tar: Error is not recoverable: exiting now
Why doesn't it work from bin/ ?
What does 'which tarx' show? Does it show /bin/tarx?
Note: you should *never* put random programs in /bin (or even /usr/bin).
The only programs/files in these directories should be ones installed
by your package management system. /bin is reserved for core / early
boot programs and others would be in /usr/bin.
Locally provided programs should be in either /usr/local/bin or /opt/bin
(depending on your file system usage philosiphy). These directories
can/should be added to your $PATH. *Personally* provided programs
should be in $HOME/bin, and this directory can be added to your $PATH as
well.
Probably /bin/tarx isn't the same as ./tarx. What does
cat /bin/tarx
show?
I already showed that, the two cat.. statements.
On Mon, 10 Jun 2024 11:34:30 +0000, db wrote:
On Sun, 09 Jun 2024 19:12:52 +0000, Robert Heller wrote:
At Sun, 09 Jun 2024 18:22:38 +0100 Richard Kettlewell
<invalid@invalid.invalid> wrote:
db <dieterhansbritz@gmail.com> writes:
I like to make life easy so I wrote a one-line script for extracting >>>>> the contents of a tar file. I copied it into the /bin directory so I >>>>> can run it from anywhere.
I tried it out in a test directory where I had it, and where there is >>>>> a small test tar file. Here is the dialogue from running it, using
both the local script and the one in /bin:
~/tartest> ls tarx test.tar.gz ~/tartest> cat tarx tar -xf $1.tar.gz >>>>> ~/tartest> cat ~/bin/tarx tar -xf $1.tar.gz ~/tartest> ./tarx test
~/tartest> ls tarx test test.tar.gz ~/tartest> del -r test
~/tartest> tarx test tar (child): test: Cannot open: No such file or >>>>> directory tar (child): Error is not recoverable: exiting now tar:
Child returned status 2 tar: Error is not recoverable: exiting now
Why doesn't it work from bin/ ?
What does 'which tarx' show? Does it show /bin/tarx?
Note: you should *never* put random programs in /bin (or even /usr/bin). >>> The only programs/files in these directories should be ones installed
by your package management system. /bin is reserved for core / early
boot programs and others would be in /usr/bin.
Locally provided programs should be in either /usr/local/bin or /opt/bin >>> (depending on your file system usage philosiphy). These directories
can/should be added to your $PATH. *Personally* provided programs
should be in $HOME/bin, and this directory can be added to your $PATH as >>> well.
Probably /bin/tarx isn't the same as ./tarx. What does
cat /bin/tarx
show?
I already showed that, the two cat.. statements.
Sorry, but no, you didn't.
You showed us
~/tartest> cat tarx
which gave the contents of ~/tartest/tarx, and
~/tartest> cat ~/bin/tarx
which gave the contents of ~/bin/tarx
You haven't shown the contents of /bin/tarx
Nor have you shown that there is no other version of your
tarx script in your PATH.
On Mon, 10 Jun 2024 23:00:02 +0200, Carlos E. R. wrote:
On 2024-06-10 14:35, Lew Pitcher wrote:
On Mon, 10 Jun 2024 11:34:30 +0000, db wrote:
You haven't shown the contents of /bin/tarx
There is no proof that such a file exists.
Agreed. However, the OP asserts that he (quote)
copied it into the /bin directory
and gives an example where he executes it from
(presumably, the /bin directory) in his path.
Nor have you shown that there is no other version of your
tarx script in your PATH.
That is the question to ask first :-)
That's the question I /did/ ask first :-)
On 2024-06-10 14:35, Lew Pitcher wrote:
On Mon, 10 Jun 2024 11:34:30 +0000, db wrote:
On Sun, 09 Jun 2024 19:12:52 +0000, Robert Heller wrote:
At Sun, 09 Jun 2024 18:22:38 +0100 Richard Kettlewell
<invalid@invalid.invalid> wrote:
db <dieterhansbritz@gmail.com> writes:
I like to make life easy so I wrote a one-line script for extracting >>>>>> the contents of a tar file. I copied it into the /bin directory so I >>>>>> can run it from anywhere.
I tried it out in a test directory where I had it, and where there is >>>>>> a small test tar file. Here is the dialogue from running it, using >>>>>> both the local script and the one in /bin:
~/tartest> ls tarx test.tar.gz ~/tartest> cat tarx tar -xf $1.tar.gz >>>>>> ~/tartest> cat ~/bin/tarx tar -xf $1.tar.gz ~/tartest> ./tarx test >>>>>> ~/tartest> ls tarx test test.tar.gz ~/tartest> del -r test
~/tartest> tarx test tar (child): test: Cannot open: No such file or >>>>>> directory tar (child): Error is not recoverable: exiting now tar:
Child returned status 2 tar: Error is not recoverable: exiting now >>>>>>
Why doesn't it work from bin/ ?
What does 'which tarx' show? Does it show /bin/tarx?
Note: you should *never* put random programs in /bin (or even /usr/bin). >>>> The only programs/files in these directories should be ones installed >>>> by your package management system. /bin is reserved for core / early
boot programs and others would be in /usr/bin.
Locally provided programs should be in either /usr/local/bin or /opt/bin >>>> (depending on your file system usage philosiphy). These directories
can/should be added to your $PATH. *Personally* provided programs
should be in $HOME/bin, and this directory can be added to your $PATH as >>>> well.
Probably /bin/tarx isn't the same as ./tarx. What does
cat /bin/tarx
show?
I already showed that, the two cat.. statements.
Sorry, but no, you didn't.
You showed us
~/tartest> cat tarx
which gave the contents of ~/tartest/tarx, and
~/tartest> cat ~/bin/tarx
which gave the contents of ~/bin/tarx
You haven't shown the contents of /bin/tarx
There is no proof that such a file exists.
and gives an example where he executes it fromcopied it into the /bin directory
Nor have you shown that there is no other version of your
tarx script in your PATH.
That is the question to ask first :-)
I like to make life easy so I wrote a one-line script
for extracting the contents of a tar file. I copied it
into the /bin directory so I can run it from anywhere.
I tried it out in a test directory where I had it, and
where there is a small test tar file. Here is the dialogue
from running it, using both the local script and the one
in /bin:
~/tartest> ls
tarx test.tar.gz
~/tartest> cat tarx
tar -xf $1.tar.gz
~/tartest> cat ~/bin/tarx
tar -xf $1.tar.gz
~/tartest> ./tarx test
~/tartest> ls
tarx test test.tar.gz
~/tartest> del -r test
~/tartest> tarx test
tar (child): test: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Why doesn't it work from bin/ ?
On Sun, 09 Jun 2024 14:36:49 +0000, db wrote:
I like to make life easy so I wrote a one-line script
for extracting the contents of a tar file. I copied it
into the /bin directory so I can run it from anywhere.
I tried it out in a test directory where I had it, and
where there is a small test tar file. Here is the dialogue
from running it, using both the local script and the one
in /bin:
~/tartest> ls
tarx test.tar.gz
~/tartest> cat tarx
tar -xf $1.tar.gz
~/tartest> cat ~/bin/tarx
tar -xf $1.tar.gz
~/tartest> ./tarx test
~/tartest> ls
tarx test test.tar.gz
~/tartest> del -r test
Is this a homegrown command, or does your distribution supply it?
FWIW, "del" is not a standard Unix or Linux command, and (AFAIK)
does not exist as a builtin in any Unix/Linux shell.
On Tue, 11 Jun 2024 00:55:24 +0200, Carlos E. R. wrote:
On 2024-06-11 00:35, Lew Pitcher wrote:
On Mon, 10 Jun 2024 23:00:02 +0200, Carlos E. R. wrote:
On 2024-06-10 14:35, Lew Pitcher wrote:
Nor have you shown that there is no other version of your tarx
script in your PATH.
That is the question to ask first :-)
OK:
which tarx/home/db/bin/tarx
db <dieterhansbritz@gmail.com> wrote:
On Tue, 11 Jun 2024 00:55:24 +0200, Carlos E. R. wrote:
On 2024-06-11 00:35, Lew Pitcher wrote:
On Mon, 10 Jun 2024 23:00:02 +0200, Carlos E. R. wrote:
On 2024-06-10 14:35, Lew Pitcher wrote:
Nor have you shown that there is no other version of your tarx
script in your PATH.
That is the question to ask first :-)
OK:
which tarx/home/db/bin/tarx
Edit the /home/db/bin/tarx and add "set -x" as the first line, then run
the one from /home/db/bin/tarx and report what is output by bash in
"set -x" mode.
At Sun, 09 Jun 2024 18:22:38 +0100 Richard Kettlewell <invalid@invalid.invalid> wrote:
db <dieterhansbritz@gmail.com> writes:
I like to make life easy so I wrote a one-line script
for extracting the contents of a tar file. I copied it
into the /bin directory so I can run it from anywhere.
I tried it out in a test directory where I had it, and
where there is a small test tar file. Here is the dialogue
from running it, using both the local script and the one
in /bin:
~/tartest> ls
tarx test.tar.gz
~/tartest> cat tarx
tar -xf $1.tar.gz
~/tartest> cat ~/bin/tarx
tar -xf $1.tar.gz
~/tartest> ./tarx test
~/tartest> ls
tarx test test.tar.gz
~/tartest> del -r test
~/tartest> tarx test
tar (child): test: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Why doesn't it work from bin/ ?
What does 'which tarx' show? Does it show /bin/tarx?
Note: you should *never* put random programs in /bin (or even /usr/bin). The only programs/files in these directories should be ones installed by your package management system. /bin is reserved for core / early boot programs and others would be in /usr/bin.
Locally provided programs should be in either /usr/local/bin or /opt/bin (depending on your file system usage philosiphy). These directories can/should be added to your $PATH. *Personally* provided programs should be in $HOME/bin, and this directory can be added to your $PATH as well.
Probably /bin/tarx isn't the same as ./tarx. What does
cat /bin/tarx
show?
I like to make life easy so I wrote a one-line script
for extracting the contents of a tar file. I copied it
into the /bin directory so I can run it from anywhere.
I like to make life easy so I wrote a one-line script
for extracting the contents of a tar file. I copied it
into the /bin directory so I can run it from anywhere.
I tried it out in a test directory where I had it, and
where there is a small test tar file. Here is the dialogue
from running it, using both the local script and the one
in /bin:
~/tartest> ls
tarx test.tar.gz
~/tartest> cat tarx
tar -xf $1.tar.gz
~/tartest> cat ~/bin/tarx
tar -xf $1.tar.gz
~/tartest> ./tarx test
~/tartest> ls
tarx test test.tar.gz
~/tartest> del -r test
~/tartest> tarx test
tar (child): test: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Why doesn't it work from bin/ ?
On Sun, 09 Jun 2024 16:36:49 db wrote:
I like to make life easy so I wrote a one-line script
for extracting the contents of a tar file. I copied it
into the /bin directory so I can run it from anywhere.
This is not really adressing your original question, but
since you want to make life easy, did you consider to have
tarx as alias for 'tar -xf' instead of a shell-script?
Also I wonder if the version of tar you are using really
recognizes gzipped files and inserts the -z option even
if it is not invoked with it.
* db <dieterhansbritz@gmail.com>
| ~/bin> tarx ../tarfiles/NumNotes
| tar (child): ../tarfiles/NumNotes: Cannot open: No such file or directory --<snip-snip>--
| ~/bin> ls ../tarfiles/Num*
| ../tarfiles/NumNotes.tar.gz
| The last line proves that it's lying.
Why do you expect that if you tell tar to use a file named 'NumNotes'
that it should use a file named 'NumNotes.tar.gz' instead?
Ralf Fassel <ralfixx@gmx.de> writes:
* db <dieterhansbritz@gmail.com>
| ~/bin> tarx ../tarfiles/NumNotes
| tar (child): ../tarfiles/NumNotes: Cannot open: No such file or directory --<snip-snip>--
| ~/bin> ls ../tarfiles/Num*
| ../tarfiles/NumNotes.tar.gz
| The last line proves that it's lying.
Why do you expect that if you tell tar to use a file named 'NumNotes'
that it should use a file named 'NumNotes.tar.gz' instead?
The script they quoted does "tar -xf $1.tar.gz", i.e. it adds .tar.gz.
Presumably the script they are actually running is different.
Richard Kettlewell <invalid@invalid.invalid> wrote:
The script they quoted does "tar -xf $1.tar.gz", i.e. it adds .tar.gz.
Presumably the script they are actually running is different.
Wondering: is there a space after "$1" (eg between that and the
dot). Also: is the script file a purely ASCII text file or does it
contain UTF-8 characters -- is the dot really an ASCII period
character or something else that "looks" like a period. Bash won't
like it if it is not an ASCII period and won't like white space where
it does not belong.
Note the lack of "#!/bin/bash" at the start of the file could also be
causing problems.
Ralf Fassel <ralfixx@gmx.de> writes:
* db <dieterhansbritz@gmail.com>
| ~/bin> tarx ../tarfiles/NumNotes
| tar (child): ../tarfiles/NumNotes: Cannot open: No such file or directory >> --<snip-snip>--
| ~/bin> ls ../tarfiles/Num*
| ../tarfiles/NumNotes.tar.gz
| The last line proves that it's lying.
Why do you expect that if you tell tar to use a file named 'NumNotes'
that it should use a file named 'NumNotes.tar.gz' instead?
The script they quoted does “tar -xf $1.tar.gz”, i.e. it adds .tar.gz.
Presumably the script they are actually running is different.
On Sun, 9 Jun 2024 14:36:49 -0000 (UTC), db wrote:[snip]
I like to make life easy so I wrote a one-line script for extracting the
contents of a tar file. I copied it into the /bin directory so I can run
it from anywhere.
Why doesn't it work from bin/ ?
Red face time.
I just found out that I have an alias called tarx in
my .bashrc. In fact, someone asked me about this and
I answered in the negative, without checking. My apologies!
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 490 |
Nodes: | 16 (1 / 15) |
Uptime: | 72:07:01 |
Calls: | 9,678 |
Calls today: | 2 |
Files: | 13,722 |
Messages: | 6,172,309 |