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
Related
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.
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 7 years ago.
Improve this question
I am not sure when this behavior started but by typing the ls command, I am getting the following output:
$ls
./ ../ .DS_Store Books/
I am not very sure about the first three items and they always come in every folder. Can anyone explain me how to get rid of them? I am using OS X Yosemite
The first two: ./ and ../ are current directory and parent directory respectively. You can't get rid of them. The last one .DS_Store is probably some config file/directory which you can remove with:
rm -f .DS_Store # use -r if it's a directory
But be sure to check what's its for!
The bahaviour of ls is not the reason for the "extra" output. You probably have an alias something like:
alias ls='ls -a'
in your shell. To find out exactly what it's aliased to, do:
type ls
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 7 years ago.
Improve this question
On my Ubuntu machine I want to create a custom command for compiling a c file.
At the moment I have something liks this which does not work like I want to:
#compile the file
gcc $1 -o ~/.compile-c-output
#run the program
./~/.compile-c-output
#delete the output file
rm ~/.compile-c-output
The problem is that the run command is executed before gcc is ready and so the file does not exist. How can I wait until gcc is ready and I can run the file normaly?
Btw how can I add a random number to the output file so this script also works if I run it on two different terminals?
./~/.compile-c-output
Get rid of the leading ./. That's why the file doesn't exist.
~/.compile-c-output
To get a random file name, use mktemp. mktemp guarantees not to overwrite existing files.
file=$(mktemp) # unspecified file name in /tmp
gcc "$1" "$file" && "$file"
rm "$file"
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
I want my bash script to copy the files inside the foo directory into the baz directory.
When I run this command in the terminal, it achieves what I expect:
cp -r /foo/. /baz
But when I save it as a bash script:
#!/bin/bash
cp -r /foo/. /baz
And run:
./script.sh
Then it unexpectedly copies the foo directory itself into baz (rather than only the files in foo).
What am I doing wrong? Why is this happening? How do I fix the bash script?
Edit - bad question. I ran an old version of my script without noticing. Everything does work as expected. The answers still helped me with alternative solutions.
Use rsync instead. It doesn't copy the parent directory:
rsync -r /foo /baz
Change the content of the script to:
#!/bin/bash
cp -r /foo/* /baz
To be honest, I'm not sure why you run into this issue. It works fine for me. Still, the asterisk seems more appropriate. Which OS are you running?
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this question
I'm trying to tar a two files into one, so I have this:
tar -zcvfW "${DATADIR}daily_data_files/LeveL_EOD_VOL_${1}.tar.gz" -C "${DATADIR}temp/LeveL_EOD_VOL_*_${1}.csv" >> "${DATADIR}temp/email.log"
However, I'm getting these errors:
tar: Removing leading '/' from member names
tar: /var/www/vhosts/levelats/data/daily_data_files/LeveL_EOD_VOL_20110121.tar.gz: Cannot stat: No such file or directory
tar: LeveL_EOD_VOL_*_20110121.csv: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors
I'm not sure why the tar isn't getting created, is it because it can't find the two Level_EOD files? Is the wildcard(*) wrong?
I think what is happening is that the -C option is trying to change directory into the first directory expanded by your glob pattern; I think you want:
tar -zcvfW "${DATADIR}daily_data_files/LeveL_EOD_VOL_${1}.tar.gz" -C "${DATADIR}temp/" "LeveL_EOD_VOL_\*_${1}.csv" >> "${DATADIR}temp/email.log"
Note that I split the -C option from the list of CSV files that comes after it.
The order of the option flags is significant (at least the f needs to precede the filename). Try changing from -zcvfW to -zcvWf.
Also -C takes a directory as an argument.