I am using a Macbook Pro to do some Objective-C study. Instead of using Xcode I choose to use terminal, as I don't want to create one project for each main program. The terminal works find like the one under Linux, except one thing: whenever I execute an executable file, instead of displaying the output from the start of the next line, it always displays the date, 开发者_如何学Pythonthe time and the program name first before displaying the output of my executable. I find it kind of disturbing, as it occupies more than half of the terminal width. Is there any way to remove these redundant stuff from the display?
Are you referring to a command that you entered at the shell prompt? On Mac OS X the default shell is bash, and by default it doesn't display anything extra when invoking a command entered at the shell prompt.
If you're seeing something like this
$ somecommand
Thu Aug 11 18:54:10 somecommand
command output
then either this is displayed by the command you're running or the shell must have been customized on your system. If this happens for every command, including things like "ls" and "cat", then look for ~/.bash_profile, ~/.bashrc and other standard shell startup scripts to see if someone has customized the shell.
On the other hand, if you're seeing something like this
Last login: Thu Aug 11 18:59:12 on ttys001
hostname:~ username$ somecommand
command output
as soon as you open the terminal, then there are a few different ways to cause this to happen:
- The terminal settings profile has been customized to run "somecommand" when opening the terminal. Look in Terminal > Preferences > Settings > [profile] > Shell > Startup > Run command:.
- To run your command, you opened a *.command or other file, in which case terminal automatically writes "filename ; exit;" to the command line to execute it.
If either of these is the case (though I think it's less likely this is what you're describing), that's how they behave. To not run your command that way, enter it manually at the command prompt.
Try Switching from Bash to Z-Shell.
To change the shell, just run this command in Terminal: $ chsh -s /bin/zsh . You can upgrade to the latest zsh version via MacPorts using the zsh-devel port.
精彩评论