Very simple script to copy a file#!/bin/bash#copy filemtp-getfile 6 test2.jpgI set it as executable and run it usingsudo sh ./test.shIt gives me a file called test2.jpg that has no icon and I cannot openI get a 'Failed to open input stream for file' errorHowever, if I simply issue the following from the command linemtp-getfile 6 test2.jpgIt works as expected.What is wrong with my script?I checked and the resulting .jpg file in each case has the same number of bytes. Very strange.
copying binary file(.jpg) works from command line but not from script
bash;file copy
Need to dosudo chown <user> <copied file name>Not sure why permissions would be different in each case