I want to write a easy script shell like that:
#!/bin/bash
from_directory="first_directory"
to_directory="second_directory"
rsync --archive $(from_directory) $(to_directory) | ls -R $(to_directory)/$(from_directory)
OR
cp -r $(from_directory) $(to_directory) | ls -R $(to_directory)/$(from_directory)
I have this error ==> ls: impossible to reach in / home / jilambo / week2 / shooter_game: no file or directory of this type.
In the second time, it's ok because the first_directory have been copied to the segond directory.
Thanks.
As pointed out in comments, you probaly want this.
#!/bin/bash
from_directory="first_directory"
to_directory="second_directory"
rsync --archive $from_directory $to_directory; ls -R $to_directory/$from_directory
And if $from_directory
and $to_directory
are both absolute paths, $to_directory/$from_directory
does not make sense. Might as well just do ls -R $to_directory
.