-1

I was running AutoPhrase and after running it's auto_phrase.sh shell script, I am getting the following error:

Error

After backtracing it's source, I found this line (line 32) which is causing the above mentioned error.

line

All I know is it is doing something like:

file < FILE > FILE.extension

However, I failed to understand what is happening in this line.

Can someone could explain it to me ? And how may I resolve this issue ?

Mohammad Zain Abbas
  • 728
  • 1
  • 11
  • 24

2 Answers2

0

The problem here seems to be that ./bin/tree-tagger does not exist. Note that ./bin is not the same as /bin.

That being said, the answer to your question of what file < FILE > FILE.extension does is unrelated, but these are redirects in bash. FILE is piped < into the $STDIN of file and the output is directed > to the file FILE.extension.

Locate ./bin/tree-tagger by installing it or redirecting its path appropriately to resolve the error.

Conner
  • 30,144
  • 8
  • 52
  • 73
0

As for the actual question in the title, the command means

  • ./cmd/tree-tagger-english run this command ...
  • < ... with standard input from ...
  • $f ... an (incorrectly unquoted) variable which should contain a file name ...
  • > ... with standard output redirected to ...
  • $f.tagged ... a file named by the (still incorrectly unquoted) value of $f with the string .tagged appended at the end ...
  • & ... as a background job.

Apparently ./cmd/tree-tagger-english in turn attempts to execute a command which doesn't exist, many times.

Probably the instructions tell you to run the thing in a different directory than where you are actually running this; but this is obviously merely a speculation. Another fairly common scenario is that something failed during installation, but you failed to notice (and so some files which should exist in these locations do not actually exist ... disk full? Wrong permissions?)

The fact that the code contains quoting bugs suggests that it's also quite possible that the code is simply buggy.

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • In this specific instance, the quoting (while good practice) looks unnecessary. The script is generating specifically named files earlier which will not contain whitespace / special characters etc. – borrible Nov 20 '18 at 09:20
  • @borrible No, there are no guarantees that the wildcard doesn't *also* match files which were not created by the script itself or its dependencies. The linked script contains its fair share of other shell programming antipatterns, too. – tripleee Nov 20 '18 at 09:24