Skip to content

Tag: path

Why copy command is not working when using file paths?

I’m having a problem with the copy command. cp ../teste/env/test/x.tar ../../../teste2/file The folders exist and also the file x.tar. When I start the script I’m on a different folder, so that’s why I make a ../ at the begining. It keeps giving me this error: cp: cannot create regular file …

How to make command “Hadoop” work in linux 18.04?

I installed Hadoop and now it works with command /usr/local/hadoop/bin/hadoop. Where and how should I add this path to make command hadoop work without a full path to file? I already tried .bashrc and /etc/environment, but it didn’t help. Answer You need to add it to your PATH environment variable. PATH…

Remove part of a string by using bash

I have the path /home/bamboo/bamboo-agent-home/xml-data/build-dir/NG-VOSGQL239-JOB1 and would like to get just /home/bamboo/bamboo-agent-home/xml-data/build-dir/ How can I delete the last part of the path if it can be with different lengths by using Bash? Answer Using bash regex =~:

How to set PATH in Ubuntu 17.10 for custom path

I made a folder called bin in /home/USER/bin on this, I created a file called hello ( for example) with this code: I did execute export PATH=$PATH”:$HOME/bin” and then $ . ~/.bashrc, but when I restarted the PATH is restored to default. How can I resolve it? Thank you! Answer The user bin director…

Non-dash related bad substitution error

I am trying to write a bash script performing to find and pull somewhere else a specific file type. So far, I came up with the following script: find ./to_compress -type f -iname “*.tar” -mindepth 1 -maxdepth 1 -exec mv {} ./compressed/${{}##*/} However the bash complains that ${{}##*/} is a bad s…