Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Terminal Lesson 10

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
6,787
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Sep 3, 2008

The tenth terminal lesson

Look at the last 6 seconds. They're the funniest part!

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (macheads101)

  • 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 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 ;)

see all

All Comments (34)

Sign In or Sign Up now to post a comment!
  • I put my script files in a .dmg (disk image)

  • @d4ir3 You have to remember to say the file name after chmod +x

  • @thecomputerist thats implied in the tutorial where I show rm...

  • did he already teach us the rm-rf / ?

  • its not working for some reason... do you need a certain software?

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more