I have searched for variable syntax and other commands but I cannot get through.
I have some folders created with btrfs snapshots. Within each folder there is a file called /etc/fstab that I need to edit and replace always the same value with the one from the folder's path. For example I replace @ with @snapshots/daily/root2020-12-27_19H05
The variable here is 2020-12-27_19H05 always prefixed with root.
Before I get to editing a file, 1st step is to do something simple like making a simple bash script which creates a file as root in each folder found by the variable, I have:
cd /.snapshots/daily SNAPSHOTS=$(ls -d root*/) echo > $SNAPSHOTS/test But I get the following error:
bash: $SNAPSHOTS/test: ambiguous redirect I tried various ways with "", '', (), {} in every location I could think of but it fails. I tried with SUDO in some places but fails as well. It seems common on internet but what I read didn't me understand and fix my issue.
What am I doing wrong?
Thanks!