Closed damacguy closed 3 years ago
I might try and get around it. What were you trying to do when it crashed?
Ah, that would help. I was doing my initial download of scripts from my Jamf server. Hit this one script near the end and it said the path didn’t exist. Guessed it was a forward slash and sure enough it was. Replaced the forward slashes (there were two) with dashes and tried again and it work fine.
OK, so do you think it should do a quick rename of the script or give an error message and continue? I can see benefits either way.
The easy fix is to warn users in advance. Better might be to check in advance and either abort or skip with an alert. The best would be to escape the "/". Programmer's choice. ;-)
I'm not sure '/' can be escaped. You can't do it in the shell IIRC. I think I'll skip with a note.
The code now checks for '/' and prints a warning then skips the script.
The script saw it as a directory indicator when it wasn't so it crashed.
Silly to have it in the script name in the first place. Work around is easy enough - I renamed my script.