Terminal: Window group with commands

Hi, how can I set up a Terminal window group that executes a different command for each window?
What I'm trying to do is restore an array of Terminal instances each pointing to a different location when Terminal opens (so one window should execute "cd x," the next "cd x/src," etc.).
With Tiger I could create a .term file and set an "ExecutionString" (that's how commands were labeled in the .term file format) property for each window, but with SL I'm only able to create one shell command in Preferences|Settings that is executed by all Terminal windows in the group.
So basically, how can I get Terminal to remember a group of windows and their associated file system locations?
I've spent a few hours searching and trying stuff without success. The window groups are stored in Terminal's .plist file so I opened it with Property List Editor and see the Window Groups stored in there but no properties resembling a command for each group.
Thanks!

neenach2002 is basically correct on this one; this post got me pointed in the correct direction. I've gone a little farther to suit my needs (and answer your question directly), so I figured I'd post my results:
First, create a file called "~/window1.bashrc" and place the following in it:
export MYHOME=/Volumes
cd ${MYHOME}
Next, go to Terminal -> Preferences -> Settings. Create a new profile called "MyProfile_Window1" based on one you like, then go to the Shell button, and type "bash --init-file ~/window1.bashrc" (without quotes) into the filed labeled "Run command." Be sure the check box next to it is checked.
Repeat for as many windows as you want, changing your label to Window2, Window3, etc. Be sure you have created the associated ~/window2.bashrc, ~/window3.bashrc, etc also.
You should now be able to open a new window or a new tab via Shell -> New Window -> MyProfile_Window1 or Shell -> New Tab -> MyProfile_Window1, and it should go directly to the directory you want.
Once you have used the menu options above to launch all your windows, save THAT as your window group via Window -> Save windows as group, and under Terminal -> Preferences -> Startup, be sure your newly saved window group is set to launch.
Hope it helps!
- Kevin
PS: If you would like to use this to attach to multiple servers, you can do the same thing by just launching a shell script that performs an SSH to the appropriate server. To take it one step further, consider using the unix "screen" utility to allow you to instantly reconnect to a dropped setup! I think I'll write a User Tip for this - it's a very handy setup!

Similar Messages

  • Where is the Terminal Window Groups settings saved?

    Where is the Terminal Window Groups settings saved?  Would love to copy my Window Groups and customization to another computer.

    It's stored in the standard Terminal preferences file, namely ~/Library/Preferences/com.apple.Terminal.plist

  • Button Group with Command SAVE_DATA execute with ENTER

    Hello,
    I created a Button Group with Command SAVE_DATA and execute it with ENTER. I use it in a Webtemplate.
    Most of the time the Button is working in proper way.
    Sometimes it happens that the Enter doesn't work and don't save data. To press the Button to Save data is always working.
    Any ideas why?
    Thanks a lot.
    Kind Regards
    Doris

    Hello,
    thank you for your answers. I checked the Notes for the Cache problems. I think this is not valid for my Template because the data are correctly saved if I press the Save Button after the Enter is not working.
    The strange thing is the behavior that it is sometimes not working and not allways. Also it is not possible to place the Save Button outside the planning cells. But I will keep this in my mind.
    Any other ideas?
    Thanks a lot.
    Kind Regards
    Doris

  • Terminal & do script with command

    Hello,
    i am wondering why this applescript snippet:
    tell application "Terminal"
    activate
    do script with command "cd " & quoted form of the_path
    end tell
    Opens 2 Terminal windows if Terminal is not running while executing the code.
    Is there a way to get the command executed in the first window ?
    I really dont need to windows if possible.
    Best regards
    fidel

    i am wondering why this applescript snippet... Opens 2 Terminal windows if Terminal is not running while executing the code.
    Because, by default, whenever you tell Terminal.app to do script it opens a new window to execute it in. So you're launching Terminal.app (which opens a new window) and then executing do script which opens another window.
    Is there a way to get the command executed in the first window ?
    Yes. Tell Terminal.app that's what you want:
    tell application "Terminal"
      do script "cd " & quoted form of the_path in window 1
    end tell
    Note, though, that this is prone to problems - for example, if the front window is running a ssh session to another server then you'll execute the cd command on the remote machine, not your local machine. This is why it's often safer for Terminal.app to open new windows.

  • Why do Terminal Window Groups Get 2 Columns Wider Every Launch?

    I set up 3 terminal windows of different sizes, place them where I want, and save as a "Window Group." Then I set this Window Group to be used when launching Terminal.
    Lion has introduced a bug whereby every time you launch the Terminal app, each window in the Window Group gets wider by 2 columns. It is 100% reproducible and incredibly annoying.
    For example, follow these repro steps:
    Launch Terminal. Your first window in the group is 140 columns wide, just as you saved it.
    Quit Terminal.
    Launch Terminal. Your first window in the group is 142 columns wide. The other windows are similarly wider by 2 columns.
    Quit Terminal.
    Launch Terminal. Your first window in the group is 144 columns wide. Again, the other windows are also wider by 2 columns.
    ... and so on...
    If you select "Window > Open Window Group" and choose the same group, it will open them at the intended sizes. However, this doesn't solve the problem.
    Is there a work around to prevent this?
    Thanks,
    Tim

    a fix from apple will probably take some time (apple is not fast about bugs they consider minor).  in the meantime, you can use something like the following as a workaround.  copy the following into a plain-text editor and save it as <whatever>.applescript (somewhere out of the way - it doesn't matter where you save it so long as there are no permissions issues).
    tell application "System Events"
              set terminalPlist to property list file "~/Library/Preferences/com.apple.Terminal.plist"
              tell terminalPlist
                        set defaultWindow to value of property list item "Default Window Settings"
                        tell property list item "Window Settings"
                                  tell property list item defaultWindow
                                            if value of property list item "columnCount" ≠ 80 then
                                                      set value of property list item "columnCount" to 80
                                            end if
                                  end tell
                        end tell
              end tell
    end tell
    You could also save this as a compiled script (.scpt) using script editor; doesn't really matter.
    Then, copy the following into a plain-text editor and save it as user.terminal.widthFixer.plist (the name doesn't really matter, so long as it ends in .plist), in the folder ~/Library/LaunchAgents.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
              <key>Label</key>
              <string>user.terminal.widthFixer</string>
              <key>ProgramArguments</key>
              <array>
                        <string>osascript</string>
                        <string>/Users/<yourname>/path/to/script.scpt</string>
              </array>
              <key>WatchPaths</key>
              <array>
                        <string>/Users/<yourname>/Library/Preferences/com.apple.Terminal.plist</string>
              </array>
    </dict>
    </plist>
    <yourname> should be your short user name, obviously, and the path in the ProgramArguments array should point to the script.  Log out and log back in, and this script should (in the simplest case) automatically reset the window width.
    caveats:
    I can't test this (the external disk with my Lion installation died), so I can't guarantee it will work out of the box
    depending on whether the increment occurs at startup or shutdown, you may need to set columnCout to 78 instead of 80 to get the right final size
    make sure you use a plain-text editor (TextWrangler, TextEdit in plain text mode, or any programmer's editor).  using a formatted text editor will mess things up.
    if you have a complex setup you may need to reset Window Settings other than the default one. All this means is changing tell property list item defaultWindow to tell property list item "window settings name".  adjustments should not be difficult, but post back with details if you need specific instructions.

  • Cant install software from disk. Terminal window opens with a logon and bash message?

    I cannot install software from disk & in some cases download.
    If any software disk is inserted the terminal window appears.
    The Disk has to be clicked to open the contents but install files or package files show as a blank doc and not the usual yellow package icon.
    All that shows is a log on message in the terminal window, but nothing about install.
    I thought Drive issues but the drive plays audio and DVD perfect
    I cannot install:-
    Office for mac updates
    Live Interior 3D (managed to install from download)
    ION Audio Converter
    This has only come to my attention in the last couple of weeks.
    The machine is a late 2011 with Lion installed

    Contact Apple Service, iMac Service or Apple's Express Lane. Do note that if you have AppleCare's protection plan and you're within 50 miles (80 KM) of an Apple repair station, you're eligible for onsite repair since yours is a desktop machine.

  • Add Service Account to windows group

    Hello,
    I was wondering if it possible to add a service account to a windows group with Powershell? I would like to add a sql server service account to a windows group. Unfortunately, the OS I have installed does not permit using Local Users and Group
    or ADUC.
    Any help is appreciated.
    jim

    This should work:
    ([ADSI]"WinNT://$computer/$Group,group").psbase.Invoke("Add",([ADSI]"WinNT://$domain/$user").path)
    Supply the values to the variable names or just replace them with the actual values you need to use.
    Credit goes to jrv...
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/35b8022e-7c0e-49fb-b4c7-346b83ed3fd0/powershell-oneliner-to-add-domain-user-to-a-local-group?forum=ITCG
    I hope this post has helped!

  • Terminal: "open -e/t" question.  Windows group question

    2 questions regarding Terminal
    1. Is it possible to make it so the open -e, or open -t command, instead of opening TextEdit, opens a different text editor?
    2. Is it possible to open a Windows group, and have JUST 1 of the windows execute an ssh command?

    1. Is it possible to make it so the open -e, or open -t command, instead of opening TextEdit, opens a different text editor?
    Sure. 'open -t' uses the default text editor application, as defined by LaunchServices. On a standard system this is TextEdit.
    If you want to have 'open -t' use a different TextEditor then you need to specify an alternative application as the default text editor.
    This is easiest done by selecting a plain text (.txt) file in the Finder and choosing File -> Get Info. In the 'Open with' pane you can choose an alternative text editor and clicking the 'Change All' button will update the LaunchServices database with the specified application as the default.
    Now any .txt file you open will launch in this application, whether it's opened in the Finder, or via 'open -t'.

  • How to get default command to open a terminal window? (Bash or Python)

    Desktop entry files (.desktop files) may indicate that an application requires a terminal window to run ("Terminal=true"), e.g. vim & maxima.
    How does a .desktop launcher determine which terminal to use? E.g. when opening a file associated with vim, what points it to 'urxvtc -e %s' or 'gnome-terminal...' or whatever?
    Is there a standard environment variable with the terminal command? $TERM only contains an identifying name but I don't see how to programmatically deduce the command from it. Grepping through the output of "set" doesn't show me anything useful either.
    My search-fu has failed me. Does anyone have any ideas?
    EDIT: Clarified subject and post.
    Last edited by Xyne (2011-02-02 14:00:14)

    Maybe my search-fu can be of help here:
    For KDE:
    terminal=$(kreadconfig --file kdeglobals --group General \
    --key TerminalApplication --default konsole)
    For GNOME:
    TERM_EXEC_KEY="/desktop/gnome/applications/terminal/exec"
    TERM_EXEC_ARG_KEY="/desktop/gnome/applications/termina/exec_arg"
    TERM_EXEC=$( gconftool-2 --get ${TERM_EXEC_KEY}) # e.g.
    "gnome-terminal"
    TERM_EXEC_ARG=$( gconftool-2 --get ${TERM_EXEC_ARG_KEY} ) # e.g. "-x"
    terminal="$TERM_EXEC $TERM_EXEC_ARG"
    For XFCE:
    Xfce has a directory called "share/xfce4/helpers/" which contains desktop entry files for commonly used terminals, browsers and email apps. These entries contain extra keys like X-XFCE-Category=WebBrowser or X-XFCE-Category=TerminalEmulator .
    Then there is a file called ".config/xfce4/helpers.rc" which in my case looks like:
    WebBrowser=firefox
    MailReader=thunderbird
    From: http://www.mail-archive.com/[email protected] … 01661.html
    edit: there is also xdg-settings (in xdg-utils) which can store default-app information, but i'm not sure if all DE's make use of this..
    Last edited by litemotiv (2011-02-02 14:08:27)

  • Problems with Java, (i.e, compiling, etc) & Terminal Window

    I am having a problem compiling my program in the Terminal Window. I am working on Java for my ICS class and the first project compiled and ran fine through Terminal Window, but when the next assignment came, it throws this error:
    class file has wrong version 50.0, should be 49.0
    Here's the screen image:
    http://tinypic.com/view.php?pic=6ywfbx3&s=1
    I'm not sure what the problem is, is there an expert out there? Also, I think there is something wrong with my Terminal Window as I cannot change directories, run/compile program "in" the shell, for example, when I want to compile a program, I have to press "COMMANDSHIFTN" so I can run it from here(it's the "New Command" window:
    http://tinypic.com/view.php?pic=879bqrd&s=1
    Whereas I have seen every other Mac user in my class compile their program easily by pressing Enter "in" the shell, just like command prompt.
    If I am not making myself clear please let me know, I'm trying to explain as specifically as I can.
    One more note:
    When I type in the shell and press Enter, it just goes down a line like a Word document.
    Here is an example, it follows in order:
    1) http://tinypic.com/view.php?pic=6z955oh&s=1
    2) http://tinypic.com/view.php?pic=8aw1dox&s=1
    3) http://tinypic.com/view.php?pic=7xln5fp&s=1
    4) http://tinypic.com/view.php?pic=873mr5w&s=1

    For your issues with Terminal:
    Discussions > Mac OS X Technologies > Unix
    For your Java problems:
    Discussions > Developer Forums
    You're more likely to find answers to your questions there…

  • Can I open new terminal window with the same path?

    Hello.
    I use Terminal for bash-shell.
    When I work at a certain directory, can i open new terminal(command + N) with the same directory?
    For example, when i am in /Developer and press command+N, I want a new terminal window with /Developer path.
    Thanks for reading and I'm sorry for my short english.

    Command-N will open a new Terminal window in your Home (~) Directory by default.
    Use the "Open Terminal Here" script for more control
    http://www.entropy.ch/software/applescript/

  • How to close Terminal Windows and terminate processes with Applescript?

    I'm trying to quit the Terminal via AppleScript. I need to run 4 different Terminal scripts on a server but would also need to restart this server every day automatically... and my favorite choice would be to do this properly.
    I suceeded terminating all other applications, cleaning folders and sending messages, but I did not find a solution quitting the Terminal!
    When I tell it to quit, it asks if I want to terminate all processes, even if I use the "ignoring application responses" command. The Terminal gets stuck on that dialog box and one has to manually hit "Terminate".
    Anyone knows about a solution how to avoid this prompt or how to default "Terminate"? There must be something like "close window 1 with process terminate", or?
    Many thanks in advance!

    :-))) Sometimes the answer is so easy... Thanks a lot!

  • If I have a program that runs in windows under the command prompt and on Mac in the Terminal window, can it be run in iOS

    I have a program that is ran using the command line in windows and the terminal window on Mac or LInux.  Is it possible to create an app for the iPad that could run this program.  This program does require admin rights.

    No.

  • Closing active terminal window with applescript

    I made a very basic script to lock my screen, and I like how it works. Some of my co-workers would also like it but it has one problem.
    When the script runs, a terminal box pops up at the end saying [process complete]. I can click through this and I don't care, they do.
    I can't just killall terminal because we use terminal and that could kill our work.
    We sometimes need to see output from a script and like the process complete, so don't want to reconfigure our systems to never display it.
    I'm trying to find a way to use applescript or something to kill the active terminal window, or the window with the title of LockScreen or something.
    Anyone have an idea?
    I was hoping something like this would exist but it doesn't seem to: tell application "Terminal" to close window

    Here is an easy approach.  Start Applications -> Automator
    Select Application
    In Automator search for "Start Screen Saver".  This should be under Library->Utilities
    Drag "Start Screen Saver" to the right side panel.
    Save the Automator app.
    If the user has System Preferencs -> Security -> Require Password ... set, then one the screen saver has started running, it will require the user to enter their password before getting control back.
    This Automator app can be double clicked, it will not require the terminal.
    With respect to your script.  If this is a shell script, AND if you wish to continue using it, then you could create an Automator app that uses "Run Shell Script" under Automator Library->Utilities.  This will also NOT require the use of Terminal, however, be aware that when Automator runs a shell script it DOES NOT have the same environment as when you are running a shell script at your Terminal prompt.  There are very few environment variables set, and for example the USER, HOME, current working directory, PATH, etc... may not be the same.  If you have dependencies on specific environment information, you may want to write a simple automator script the using "Run Shell Script" to output various environment information into a file so you can see what you have to work with
    (id -a
    pwd
    echo "$#"
    echo "$@"
    printenv
    ) >/tmp/automator.environment.txt

  • Problems : Starting up with CDE and Opening terminal window in JDS

    Hi
    I installed Solaris 10 GA on the system having 2.8 GHz Dual Xeon processor with EM64T.
    Installation process was fine and completed. But, I have two problems with CDE and JDS.
    Firstly, in JDS, the graphical login comes up, works fine. After I login (as root or anyone), sometimes terminal window does not start up correctly. The windows for terminal apprear, but there is no display. Thus, I cannot use the terminal in JDS, while the other menus on launch panel (e.g. StarOffice) seem to work properly.
    Secondly, in CDE, I can login, the hourglass pointer appears and changes to arrow pointer. But then, there are no items except only the pointer and wallpaper.
    Both problems do not happen at every login time. when the problems happen, I have to reboot (in CDE/JDS) or re-login (in JDS). After some rebooting or re-login, things work fine again.
    Can everybody help me?
    Thanks

    I am not Adobe staff, but I have never heard of an "online upgrade". When I purchased my CS6 upgrade  from Adobe, they sent me an email with the serial.
    Who did you go through to get this upgrade?

Maybe you are looking for

  • How to set an icon of a Button in ActionScript ?

    A need to create at runtime some buttons and set their icons. I found a problem to do that in ActionScript. In MXML is easy to set the icon just use a syntax like this: <mx:Button label="some text" icon="images/ok.png"/> But in ActionScript how I can

  • Will Hyper-V Replication Manager move a VM without shutting it down?

    Scenario Let say I have two sites (Primary And DR). I have my production VM's running on my Primary Site.  If I protect them with Hyper-V Replica the VM is replicated and I can bring the VM up manually in the DR site. So I know that process work. I a

  • Format Error : mkfs.ocfs2 1.2.7 file system too small for a journal

    Hi All, I am trying to implement Oracle 10g RAC on my laptop using vmware and openfiler software . But while executing the command #mkfs.ocfs2 -b 4K -C 32K -N 4 -L oracrsfiles /dev/iscsi/crs11/part1 I am getting the error Format Error : mkfs.ocfs2 1.

  • MY iphone 5s version 7.1.1 can not connect to 3G

    I just try to move my chip to another iphone and he work good, but on my iphone he don't work! please help

  • ActionListener issue JSF Tiles

    I have a bug on my module. the command button for save is not invoking the action event defined in my tiles (fragment.xml). when i turned on my debug perspective using eclipse. the save button will function as normal, it will go to my breakpoint in e