-
All replies
-
Helpful answers
-
Jul 24, 2016 4:36 AM in response to JackTheSon1by VikingOSX,If you posted some of that example code that does not work for you in the Terminal, it would be easier to determine next steps.
-
Jul 24, 2016 8:46 AM in response to JackTheSon1by BobHarris,The Terminal does not run your code. At the command prompt it is the 'bash' shell (Bourne Again Shell, which is a play on words for the one of the first shells written by a guy named Bourne which was called the Bourne Shell)
But the code could also be any number of scripting languages (Perl, Python, Awk, C, FORTRAN, etc...). Chances are if you read a web page that said paste this into a Terminal window it is 'bash' shell commands, but with out seeing the commands, it is impossible for us to guess. We can only assume.
And commands specific syntax which must be obeyed.
A carriage return generally tells the shell to execute the command, but if the way you obtained the commands split the command due to some line wrapping done by some word processing utility, or web browser, a carriage return may show up in the wrong spot. Or extra arguments which are really the command were appended to the end of one command.
Again, we have to see the commands to tell what is going on.
Another problem my be the font. The 'bash' shell and commands mostly have to be simple ASCII letters, spaces, dashes, etc... UNICODE, especially the curly quotes are not going to cut it.
Another problem that crops up form time to time, is if lines came from a Windows system where <CR><LF> pairs are included in the text. This upsets most shells. Generally not an issue for copy and paste, but a real problem for shell scripts in file form that passed through a Windows system.
There are tons of ways your copy and paste could cause problems for the Terminal, but without seeing what you tried to pastes, it is impossible for us to figure out what went wrong.
-
Jul 24, 2016 11:24 AM in response to JackTheSon1by Mark Jalbert,I recommend that you refrain from pasting multiple lines of code into your shell. If you are attempting to run code from a web page then you should be aware of "clipboard poisoning". Any code that is copied to the clipboard should be sanitized before it is run. Place the content of the clipboard into a file.
pbpaste > testfile
Use a text editor that can show invisible characters and edit as necessary. Assuming the code was meant to be run in the bash shell then
bash testfile