Duck
Duck

Reputation: 36013

Failure to execute TAR inside Bash

I type this line on terminal:

tar -czf temp.tar.gz  aDirectory/*

it works.

I add this line inside a bash script:

invalid command name "tar"
    while executing
"tar -czf temp.tar.gz  aDirectory/*"
    (file "./backup" line 3)

I have tried also to precede tar by /usr/bin. Same problem.

Why?

Upvotes: 0

Views: 148

Answers (1)

pynexj
pynexj

Reputation: 20797

The error message looks like it's reported from .

[STEP 116] $ cat backup
#!/usr/bin/tclsh

tar -czf temp.tar.gz  aDirectory/*
[STEP 117] $ chmod +x backup
[STEP 118] $ ./backup 
invalid command name "tar"
    while executing
"tar -czf temp.tar.gz  aDirectory/*"
    (file "./backup" line 3)
[STEP 119] $

Upvotes: 1

Related Questions