Added: 3 years ago
From: macheads101
Views: 6,880
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (36)

Sign In or Sign Up now to post a comment!
  • how do you make it so it doesn't echo the command

  • is there a command to start one of these files?

    

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

  • I put my script files in a .dmg (disk image)

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

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

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

  • starting at 4:17 it's funny

  • woh,

    easy at 3:58

    you're starting to scare me

    how old are you?

  • 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.

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

  • how do you get it to close out of nano after saving?

  • Control + X, y, enter.

  • 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

  • when I open up my Bob terminal file it still opens in TextEdit, why is this? btw I am running on Tiger

  • 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.

  • For some reason chmod =x filename does not make my text document an executable file, why is that?

  • +x not =x!

  • killall wont work on my computer

  • 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?

  • If they have a Unix OS based it might work, and yes you can.

  • what do you type in to make everything close when they open it?

  • killall Whatever you want to kill

  • is there one command that will kill all of the things that they have opened though?

  • No, sorry.

  • Comment removed

  • 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.

  • 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.

  • how do you put CMD on a mac computer and does mac have notepad like windows does

  • Mac has something called Text Edit and Mac is UNIX based so there is not CMD.

  • if i send it to a window user, will it sill work?

  • No because this in UXIX based.

  • even when you send it to a computer that can speak?

    so how to make it work for both macs and windows?

  • 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.

  • 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.

  • 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.

  • how about you do the samething using a windo, and just copy it and post into the terminal with the mac codes.

  • No because it is not the same code.

  • OK.

  • Yeah.

  • whats up with the end??

  • ha i don't know i felt like mixing things up a bit.

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