V
V
vasIvas2017-09-12 12:15:38
linux
vasIvas, 2017-09-12 12:15:38

How to copy a directory using bash with cyrillic?

How to use bash to copy a directory /home/user/Рабочий стол/a/dirto /home/user/Рабочий стол/b/?
Tried as below, but it doesn't work.

#!/bin/bash

dir=$PWD

cp $dir/a/src $dir/b/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexy Rozman, 2017-09-12
@vasIvas

For directories, you need the flag: -r
It's always a good idea to escape variables with double quotes:
cp -r "$dir/a/src" "$dir/b/"
This will solve problems with spaces and other specials. characters...
Alternatively, you can use bash auto-completion by writing/copying the beginning of the name and pressing tab.
In this case, bash escapes everything you need with "\":
cp -r /home/user/Desktop/a/dir /home/user/Desktop/b/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question