• Re: tar problem

    From Lew Pitcher@21:1/5 to All on Sun Jun 9 16:01:21 2024
    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
    ~/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/ ?

    Are you certain that you are running the right tarx?

    What does your $PATH look like? Is there a tarx executable
    in any of the directories /before/ your ~/bin in your PATH?
    If so, what do /they/ look like?



    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marco Moock@21:1/5 to All on Sun Jun 9 17:28:38 2024
    On 09.06.2024 um 14:36 Uhr db wrote:

    Why doesn't it work from bin/ ?

    Can you run it with bash -x?
    Maybe the path isn't passed as a fullpath.

    --
    kind regards
    Marco

    Send spam to 1717936609muell@cartoonies.org

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Kettlewell@21:1/5 to dieterhansbritz@gmail.com on Sun Jun 9 18:22:38 2024
    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?

    --
    https://www.greenend.org.uk/rjk/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert Heller@21:1/5 to invalid@invalid.invalid on Sun Jun 9 19:12:52 2024
    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?


    --
    Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
    Deepwoods Software -- Custom Software Services
    http://www.deepsoft.com/ -- Linux Administration Services
    heller@deepsoft.com -- Webhosting Services

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Fritz Wuehler@21:1/5 to All on Mon Jun 10 02:29:25 2024
    db <dieterhansbr...@gmail.com> [d]:
    Why doesn't it work from bin/ ?


    First check whether ~/bin is part of your $PATH environment
    variable:

    $ echo "$PATH" | tr : '\n' | grep "$HOME"/bin | grep . && echo OK



    Then check whether the script has its execute bit set:

    $ find "$HOME/bin/tarx" -perm /u+x | grep . && echo OK



    Then replace the contents of your script with the following
    more resilient version:

    #!/bin/sh
    [ -r "$1".tar.gz ] && tar -xf "$1".tar.gz

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to All on Mon Jun 10 12:35:39 2024
    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.


    [snip]

    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Carlos E. R.@21:1/5 to Lew Pitcher on Mon Jun 10 23:00:02 2024
    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.

    Nor have you shown that there is no other version of your
    tarx script in your PATH.

    That is the question to ask first :-)

    --
    Cheers,
    Carlos E.R.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Carlos E. R.@21:1/5 to Lew Pitcher on Tue Jun 11 00:55:24 2024
    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:
    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

    Yes, the text does say that, which I found confusing compared with the
    command line paste.



    and gives an example where he executes it from
    (presumably, the /bin directory) in his path.

    A simple "which tarx" would clarify things.


    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 :-)

    Ok :-)


    --
    Cheers,
    Carlos E.R.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Carlos E. R. on Mon Jun 10 22:35:26 2024
    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:

    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.

    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 :-)

    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to All on Mon Jun 10 22:56:55 2024
    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.

    ~/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

    The error message implies that
    a) tar can't find an input file called "test", and
    b) that your tarx command doesn't expand it's argument
    into a filename that tar /can/ find.

    Why doesn't it work from bin/ ?

    What shell do you use?
    Do you have an alias set for tar or tarx?

    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Carlos E. R.@21:1/5 to Lew Pitcher on Tue Jun 11 02:42:35 2024
    On 2024-06-11 00:56, Lew Pitcher wrote:
    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.

    AFAIR, SuSE had it quite long ago. Probably an alias.

    There is a dir command, though :-)

    ...

    --
    Cheers,
    Carlos E.R.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to dieterhansbritz@gmail.com on Tue Jun 11 17:07:25 2024
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Rich on Tue Jun 11 18:36:46 2024
    On Tue, 11 Jun 2024 17:07:25 +0000, Rich wrote:

    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.

    or, just
    sh -x tarx text


    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From candycanearter07@21:1/5 to Robert Heller on Wed Jun 12 06:45:02 2024
    Robert Heller <heller@deepsoft.com> wrote at 19:12 this Sunday (GMT):
    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.

    Technically, /bin is usually a symlink to /usr/bin, but still yeah never
    put stuff in there.

    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.

    I think $HOME/.local/bin is a common one too.


    Probably /bin/tarx isn't the same as ./tarx. What does
    cat /bin/tarx
    show?




    --
    user <candycane> is generated from /dev/urandom

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Olschok@21:1/5 to All on Wed Jun 12 15:29:57 2024
    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.

    --
    M.O.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Wed Jun 12 18:49:24 2024
    * 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?

    R'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From marrgol@21:1/5 to All on Wed Jun 12 19:33:33 2024
    On 2024-06-09 at 16:36 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
    ~/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/ ?

    Does it work if you specify the full path of the executable in ~/bin/,
    i.e. '/home/db/bin/tarx test'?
    If it does, what do 'type -a tarx' and 'hash -t tarx' commands return?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert Heller@21:1/5 to Marc Olschok on Wed Jun 12 18:21:27 2024
    At Wed, 12 Jun 2024 15:29:57 -0000 (UTC) nobody@nowhere.invalid (Marc Olschok) wrote:


    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.

    Generally, tar under Linux is Gnu Tar, which does recognize compressed tar files, but generally only doublely extensioned filenames (eg mumble.tar.gz or mumble.tar.bz2, etc.)



    --
    Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
    Deepwoods Software -- Custom Software Services
    http://www.deepsoft.com/ -- Linux Administration Services
    heller@deepsoft.com -- Webhosting Services

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Kettlewell@21:1/5 to Ralf Fassel on Wed Jun 12 20:16:06 2024
    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.

    --
    https://www.greenend.org.uk/rjk/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert Heller@21:1/5 to invalid@invalid.invalid on Wed Jun 12 21:08:37 2024
    At Wed, 12 Jun 2024 20:16:06 +0100 Richard Kettlewell <invalid@invalid.invalid> wrote:


    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.


    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.

    --
    Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
    Deepwoods Software -- Custom Software Services
    http://www.deepsoft.com/ -- Linux Administration Services
    heller@deepsoft.com -- Webhosting Services

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Kettlewell@21:1/5 to Robert Heller on Thu Jun 13 08:33:55 2024
    Robert Heller <heller@deepsoft.com> writes:
    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.

    I think you need to review the first post in the thread. They already
    have a working script, all they need to do is run it instead of the
    broken one; that is what they are having troble with. Knowing the
    difference between the two scripts won’t help at all.

    Note the lack of "#!/bin/bash" at the start of the file could also be
    causing problems.

    Again I think you need to review the first post in the thread. This
    would not cause the problem that’s actually on display.

    --
    https://www.greenend.org.uk/rjk/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Thu Jun 13 10:50:45 2024
    * Richard Kettlewell <invalid@invalid.invalid>
    | Ralf Fassel <ralfixx@gmx.de> writes:
    | > 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.

    Ah, sorry for the noise. Hadn't spotted that post.

    | Presumably the script they are actually running is different.

    Obviously it is, considering the tar message.
    Should be trivial to 'type tarx' to find out instead of accusing tar of
    lying (but creating conspiracy contexts where none exist seems en vogue
    these days... :-()

    R'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Carlos E. R.@21:1/5 to Richard Kettlewell on Thu Jun 13 20:00:16 2024
    On 2024-06-12 21:16, Richard Kettlewell wrote:
    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.

    Thus it is not obeying the -x in bash.


    Presumably the script they are actually running is different.

    Yes.


    --
    Cheers,
    Carlos E.R.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to All on Fri Jun 14 14:38:38 2024
    On Fri, 14 Jun 2024 14:35:02 +0000, db wrote:

    On Sun, 9 Jun 2024 14:36:49 -0000 (UTC), 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.
    [snip]
    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!

    Apology accepted. :-)

    Glad you found (and presumably fixed) your problem.

    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)