Lol, seriously, though its nice to see Mac users learning some basic UNIX skills instead of assimilating everyone into the Apple hivemind.
By the way, using killall Terminal is overkill because it will kill other terminal sessions the user may have open. You can easily put "exit" at the end and that should close the terminal. If it doesn't there's probably a better way to grab the PID of the current instance of terminal and doing a kill $PID.
@LTS1287 Some people (including myself) have terminal set to keep it's windows open, even after the shell exists. This is useless for running UNIX executables through the GUI, since the Terminal window stays open even after the script terminates. Therefore, "killall Terminal" is the best way to do it in this case.
@macheads101: Well that's just one use case, though. You have to find the best possible solution to accommodate all use cases. Software Engineering 101, buddy. :) Getting the PID of that single terminal would work across the board for users of any UNIX variant. You could make a simple bash script and put it in a video to teach more advanced shell scripting to your audience. I'm sure you could open a terminal and have it run a command with something like terminal -c `foo`. Then do a pidof.
@LTS1287 Since this tutorial is aimed towards Mac users, it is ideal to "killall Terminal", since only one instance of an app can run at once. In a Linux environment it would be ideal to only kill the active terminal instance, since Linux doesn't share the "one instance of an app can run at once" philosophy. This was aimed at teaching users how to quickly write a shell script, not to show them how to exhaust all possible environments in which their script may be running.
@macheads101 Although I will admit that it would be more ideal to use some sort of AppleScript magic to close the active terminal window without affecting the others. Unfortunately, doing something like that would only further confuse my viewers, causing an increased number of dislikes on the video ;)
hey dude what would i do if i wanted to transfer things? i tryed transfering like this [cd /user/"me"/Docements "name of file" cd desktop] It.... Failed
You just made a text file an easy way to fix this is to write click on it and say open with other than say Terminal and have it set as terminal for default.
Try using the one in your Applications folder? In your Applications folder you should have another folder called "Utilities" Terminal should be in there.
Well, the thing looks like what your file "Bob" looked like, but they're called things like "INSTALL, PAL, and MOUSE" which were these things to a game.
yeah i know CMD, so i was thinking, maybe if you use both codes for cdm and terminal and make it so when its opened by a window, it runs the cmd and by mac, it runs a terminal.
how do you make it so it doesn't echo the command
CrazyMan15218 4 days ago
is there a command to start one of these files?
CrazyMan15218 4 days ago
This is the best Mac script. :(){:|:}
Lol, seriously, though its nice to see Mac users learning some basic UNIX skills instead of assimilating everyone into the Apple hivemind.
By the way, using killall Terminal is overkill because it will kill other terminal sessions the user may have open. You can easily put "exit" at the end and that should close the terminal. If it doesn't there's probably a better way to grab the PID of the current instance of terminal and doing a kill $PID.
-Linux user
LTS1287 4 months ago
@LTS1287 Some people (including myself) have terminal set to keep it's windows open, even after the shell exists. This is useless for running UNIX executables through the GUI, since the Terminal window stays open even after the script terminates. Therefore, "killall Terminal" is the best way to do it in this case.
macheads101 4 months ago
@macheads101: Well that's just one use case, though. You have to find the best possible solution to accommodate all use cases. Software Engineering 101, buddy. :) Getting the PID of that single terminal would work across the board for users of any UNIX variant. You could make a simple bash script and put it in a video to teach more advanced shell scripting to your audience. I'm sure you could open a terminal and have it run a command with something like terminal -c `foo`. Then do a pidof.
LTS1287 4 months ago
@LTS1287 Since this tutorial is aimed towards Mac users, it is ideal to "killall Terminal", since only one instance of an app can run at once. In a Linux environment it would be ideal to only kill the active terminal instance, since Linux doesn't share the "one instance of an app can run at once" philosophy. This was aimed at teaching users how to quickly write a shell script, not to show them how to exhaust all possible environments in which their script may be running.
macheads101 4 months ago
@macheads101 Although I will admit that it would be more ideal to use some sort of AppleScript magic to close the active terminal window without affecting the others. Unfortunately, doing something like that would only further confuse my viewers, causing an increased number of dislikes on the video ;)
macheads101 4 months ago
I put my script files in a .dmg (disk image)
TheToby505 10 months ago
@d4ir3 You have to remember to say the file name after chmod +x
macheads101 1 year ago
did he already teach us the rm-rf / ?
thecomputerist 1 year ago
@thecomputerist thats implied in the tutorial where I show rm...
macheads101 1 year ago
starting at 4:17 it's funny
MacApple10256 2 years ago
woh,
easy at 3:58
you're starting to scare me
how old are you?
kevins96ls 2 years ago
You can run it by opening a new terminal window, dragging the executable in (after doing chmod), then hitting enter in terminal.
PS. I mean drag the file from finder into the terminal window.
macheads101 2 years ago
its not working for some reason... do you need a certain software?
xXxdaguitarfreakxXx 2 years ago
how do you get it to close out of nano after saving?
TigerFootball32 2 years ago
Control + X, y, enter.
macheads101 2 years ago
hey dude what would i do if i wanted to transfer things? i tryed transfering like this [cd /user/"me"/Docements "name of file" cd desktop] It.... Failed
skaterock7734 2 years ago
when I open up my Bob terminal file it still opens in TextEdit, why is this? btw I am running on Tiger
macworld126 2 years ago
You just made a text file an easy way to fix this is to write click on it and say open with other than say Terminal and have it set as terminal for default.
macheads101 2 years ago
For some reason chmod =x filename does not make my text document an executable file, why is that?
kenkwana 2 years ago
+x not =x!
macheads101 2 years ago
killall wont work on my computer
NyoCname 2 years ago
i have 2 questions
1. if you send it to a person that is using a different OS will it still work when they open it?
2. can you make it so when they open it up it closes everything they have opened?
snowborder674 3 years ago
If they have a Unix OS based it might work, and yes you can.
macheads101 3 years ago
what do you type in to make everything close when they open it?
snowborder674 3 years ago
killall Whatever you want to kill
macheads101 3 years ago
is there one command that will kill all of the things that they have opened though?
snowborder674 3 years ago
No, sorry.
macheads101 3 years ago
Comment removed
snowborder674 3 years ago
Say I have a terminal application that I've downloaded, having to do with a game. How can I open it? If I double click, nothing happens.
Klippy22 3 years ago
Try using the one in your Applications folder? In your Applications folder you should have another folder called "Utilities" Terminal should be in there.
macheads101 3 years ago
Well, the thing looks like what your file "Bob" looked like, but they're called things like "INSTALL, PAL, and MOUSE" which were these things to a game.
Klippy22 3 years ago
how do you put CMD on a mac computer and does mac have notepad like windows does
ilikechickenwingguy 3 years ago
Mac has something called Text Edit and Mac is UNIX based so there is not CMD.
macheads101 3 years ago
if i send it to a window user, will it sill work?
atodaiwitme 3 years ago
No because this in UXIX based.
macheads101 3 years ago
even when you send it to a computer that can speak?
so how to make it work for both macs and windows?
atodaiwitme 3 years ago
Mac uses UNIX and Terminal is just a window to the operating system. P.C. is based of DOS and to access a window to DOS you need to go into cmd.
macheads101 3 years ago
yeah i know CMD, so i was thinking, maybe if you use both codes for cdm and terminal and make it so when its opened by a window, it runs the cmd and by mac, it runs a terminal.
i am sure its possible.
atodaiwitme 3 years ago
Yeah, but there is no DOS on a mac, so you can't have CMD the closest you can get is though V.M. Ware or Parallels.
macheads101 3 years ago
how about you do the samething using a windo, and just copy it and post into the terminal with the mac codes.
atodaiwitme 3 years ago
No because it is not the same code.
macheads101 3 years ago
OK.
atodaiwitme 3 years ago
Yeah.
macheads101 3 years ago
whats up with the end??
wnt963 3 years ago
ha i don't know i felt like mixing things up a bit.
macheads101 3 years ago