1

I've got a bash script in which i create a file and append to it. Problem is when I try to write to it, the shell tells me

/home/username/bin/myscript: line 62: ~/Desktop/folder/filename: No such file or directory

The script part is:

57: mkdir ~/Desktop/folder
58: touch -a ~/Desktop/folder/$1
59: chmod 774 ~/Desktop/folder/$1

61: addr=$(cat $D/$1/address)
62: echo "$addr">>"~/Desktop/folder/$1"

When I go look for the file, it appears in the ls command with the correct permissions. It also appears correctly in the file explorer.

I've tried changing between cat and echo commands to append to the file but neither works.

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232

1 Answers1

0

Try to do this on line 62:

$ echo "$addr" >> ~/Desktop/folder/"$1"
Bon Ami
  • 893