Bash doesn't see the file in the right directory [closed] - bash

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I have this bash script;
~/build/mosesdecoder/scripts/training/mert-moses.perl \
~/factored_translation/dataset/dev.tr ~/factored_translation/dataset/dev.en \
~/build/mosesdecoder/bin/moses unfactored/model/moses.ini \
--mertdir ~/build/mosesdecoder/bin \
--input-factor-max 4 \
--decoder-flags="-threads all"
When I run it, it gives me this error:
./tune-model.sh: line 2:
/export/students/sait/build/mosesdecoder/scripts/training/mert-moses.perl:
No such file or directory
But I am sure that mert-moses.pl is under /export/students/sait/build/mosesdecoder/scripts/training/ directory, and it exists.
How can I solve this problem?

You say in the comments that mert-moses.pl exists, but your script looks for mert-moses.perl. This is probably the source of your problem.

Related

Looping over file contents with the for command has issue with the last item [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I have a filename.txt with the following contents:
HEL50-C2
DEN50-C1
SFO5-C3
BRU50-C1
SCL50-C1
I have a program which runs this:
FOR /F %%G IN (filename.txt) DO (ECHO %%G)
But when I run it, it only returns a modified version of the last line of the file:
SCL50-C1C1
What am I missing? I think it has something to do with the hyphens, but I'm not sure how to account for them.
Turns out my file had only carriage return (\r) at the end of each line. When I added carriage return and line feed (\r\n) the script ran fine.

Hello world program compilation exits with stream did not contain valid UTF-8 [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
error: couldn't read main.rs: stream did not contain valid UTF-8
fn main(){
println!("Hello,World!");
}
copy paste from the docs, for some reason doesn't run.
tried an empty main function as below but that didn't work either
fn main(){
}
what does the error mean when there's no string involved?
Try these steps,
$ cargo new hello
$ cd hello
$ cargo check
$ cargo run
and must install visual studio build tools.

Bash quotes command not found [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I copied and running the command on my ubuntu 18.04 from here
https://kite.com/linux/ but got an error like:
$ bash -c “$(wget -q -O – https://linux.kite.com/dls/linux/current)”
bash: “”: command not found
$ type quote
quote is a function
quote ()
{
local quoted=${1//\'/\'\\\'\'};
printf "'%s'" "$quoted"
}
Any suggestions of the error?
You probably copied and pasted that from some word processor or website that turned the straight, regular, ASCII quotes " into pretty, curly Unicode quotes “ ”. Bash doesn't understand those. Just type them in by hand to fix the problem.

Cannot open tar file [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I have a file called data. Although the file doesn't have an extension, I used the file bash command to see what type of file it is:
$ file data
data: POSIX tar archive (GNU)
Seeing as it is a tar file, I try to open it but I get an error:
$tar xvf data
tar: data: Not found in archive
You need to add a hyphen before the xvf.
tar -xvf data
Else, if you are in another location.
tar -xvf /<path to data>/data

Bash syntax error: line 7: unexpected end of file [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
So I have a bash script
!#/bin/bash
while [ true ];do
ls -lah /sth/ | grep sth*
sleep 0.001
done
exit 0
I thoought thai it was ok but when I run it I get
line 7: syntax error: unexpected end of file
But the code has only 6 lines?
What may be a problem? I edited the file in linux, deleted unnecessary spaces but still my scropt doesn't work.
The shebang line is wrong. You are not running it under Bash at all.
#!/bin/bash
Notice the order of the sharp (#) and the bang (!).

Resources