0

I am creating file paths like so:

'/Users/User/Documents/dev/engineerappcopy/VGimages/'+deviceName+'.png'

these file paths are passed to a function as parameters, this function uses the file path to perform a command on the terminal.

However, this string seems to split into 2 parts when used by the function. presenting this error:

exec error: Error: Command failed: /bin/sh -c adb pull /sdcard/nexLogin.png /Users/User/Documents/dev/engineerappcopy/VGimages/josh
.png

/bin/sh: line 1: .png: command not found

this is because '.png' has been separated from the main string.

2
  • deviceName may contain line break or something.. but please post your question and your efforts in resolving the issue Commented Jan 16, 2017 at 14:08
  • there is no space? Commented Jan 16, 2017 at 14:09

1 Answer 1

1

Remove the new line character from the end of the deviceName variable. You should probably use the trim method to do this.

'/Users/User/Documents/dev/engineerappcopy/VGimages/'
+ deviceName.trim()
+ '.png'
Sign up to request clarification or add additional context in comments.

1 Comment

thanks, solved the error above now I have a new one. not related however, cannot seem to find the newly created image but it did before with hardcoded names.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.