History of a terminal window

I've done this successfully in the past, but at the moment I can't figure out how.
The issue is this: I've using a do script find routine that generates many thousands of files. If I redirect the output to a file in the script bundle, I get an incomplete listing. Previously, I was able to get a complete listing by getting the history of the window (which I've identified via "windows of app "terminal"). The history property of the window is defined as "the contents of the entire scrolling buffer of the window."
Since the find routine was initiated in a fresh shell, the history should be what I want, nothing more, nothing less -- and, previously, that's what I got. But now I'm blanking on exactly how I did that. If, in terminal tell block, I use "set H_ to history of (window id), I get only the initial find command.
Better would be a way of having the entire history of the window redirected in the first place.
(The solution well may dawn on me the instant I post this. The solution probably exists in some draft script on my computer, but at the moment I can't find it.)

Thanks for the comment, but, that doesn't seem to fit with what was happening:
• When I first encountered this, I was redirecting the output to a file, with the intention or reading that file.
• But what was in the file was the end of the output I expected.
• And I was using the "busy of Terminal window" approach (which we discussed at length recently) to stall the AS appropriately. Although I didn't see any error in the code, rewriting it has solved the problem, and I'm content (for now) to let sleeping dogs lie.
I like to use "do shell script," as the whole creating files and reading them routine can be avoided. But while "do shell script" seems great for short terminal procedures, for longer ones I seem constantly to be running into problems or annoyances. For Instance:
a do shell script "find" routine I was trying to use repeatedly stalled on a "permission denied" error. When I used "with administrator privileges" (requiring a password) to get past the error, later a second error stalled execution and I wasn't able to figure out the nature of the error (not that I tried very hard).
BUT WITH "DO SCRIPT" the permission error was reported but didn't stall the Terminal execution (requiring no password) AND _the second error didn't show up at all_. These differences persisted
and will still be present if I run both approaches. I know this difference has to do with how "do shell script" and "do script" handle error messages but, for now, I want hide my head in the sand and not see the error in the redirect file (or use a password to get past it).
As to "History," I've also looked at "Content," and I concluded that if everything works properly (as I thought it once did), "set H_ to history of (properly referenced Terminal window)" was an AS command that would avoid the need to redirect and also avoid the hassle of reading the file. I should look at that again, now that things seem to be working properly. I located the script that I had written previously, and that is the command I used, and I think the result was what otherwise I might redirect to a file -- so it would be a time and code saver if it was indeed returning the entire result of the Terminal command!

Similar Messages

  • Terminal window scrollback is saved somewhere?

    Dear Mac enthusiasts,
    Every Terminal window has a history, which is evident because you can scroll all the way back. In the Terminal Preferences there is even an option where you can set the Scrollback to unlimited, or limit it to a number of lines.
    My question is, is this history saved somewhere in a hidden system file or something like that? Or is it only saved in the Terminal process memory which means when you close the window, or worse, exit Terminal, this history is gone forever?
    The practical thing I'd like to be able to do is to access the scrollback info from a Terminal window that has already been closed. I catted (unix command cat) a file, then deleted the file, then closed the window, but I'd like to recover the contents of that file in this way.  I know, stupid, but if there is a solution, I'd like to hear it!
    Best regards,
    Jan

    S.Fanara wrote:
    Dear VikingOSX,
    I created an account and logged in just so say Thanks! The info you gave is golden! In Terminal I tiped open ~/.bash_history and the entire history of anything I've ever typed in Terminal was there. I edited removing mistakes and what I didn't need (as sometimes I need to scrollback and remember the command I used for specific operations) so that is a small "memorandum" id commands if you will.
    Once again thanks so much for the useful info provided!
    The history command is history.  For instance:
    history
    history | grep -i cat
    You can also use the recall operator and related — all of this is part of how bash works.

  • Closing Terminal window tabs shrinks Terminal window height

    Open a Terminal window, press Command-T to create a tab, and then Ctrl-D to close that new tab, the Terminal window height decreases by one row.
    This most certainly appears to be a bug. How do I report this to Apple?

    I am also experiencing this problem, however if you use the Basic setting the problem doesn't exist.
    I am using Novel and I have the problem. It's quite annoying.
    I noticed that if you set the fontsize to 12 then this problem exhibits, however if I change the size to 11pt or 10pt (10 is the default for Basic, 12 is default for Novel) then I don't have the bug.
    Message was edited by: TonyKL

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

  • Keyboard shortcuts: adding service to open a Terminal window not being saved

    Hi
    Objective: A shortcut to open a terminal window with the path of the 'in-focus' Finder window (Mavericks).
    Solution (that doesn't work): Apple Menu/System Preferences/Keyboard
    Select: Shortcuts
    Select: Services
    Check box for: New Terminal At Folder
    Close System Preferences
    This approach seems to be advised on quite a few sites. When I do it, the service I add simply doesn't get saved. I go back into the System Preferences and look under the path above and see that the box for New Terminal Åt Folder is unchecked.
    Any help in being able to achieve my objective would be greatly appreciated :-)

    Those things are saved as part of the workspace. It sounds as if the current workspace file has become corrupt. Close ID, then go to your user profile and you'll find the workspaces folder under \Application Data\Adobe\InDesign\Version 6.0\<language>\Workspaces. Delete the "current" xml file for the workspace and restart ID. The workspace will be restored to the conditions set when it was saved, but hopefully will remember changes again when you close the program.

  • Code to close terminal window?

    I am running code in an IDE and want to be able to have any existing terminal window close before the code is run.  This way I don't have to keep closing them manually every time I run the code again.  I'm coding in C.  Any ideas?
    Thanks

    What about setting the
    Terminal -> Preferences -> Settings -> Shell -> When the shell exits: Close the window
    Now just make sure that the last thing your script does is exit from the shell and your window will be closed.
    Then again, do you "Really" need a Terminal session to run your code?
    That is to say, running programs and scripts can be done without needing a terminal session.  The Terminal session is just a window to the command line, and you do not need to display anything via the Terminal display, then there is no reason to have it open to run your program.
    You can use Applescript ("do shell script" statement), or Automator ("run shell script" action), or you can use a 3rd party utility such as Platypus that will put your program or script in a double clickable app that does not need a Terminal session.
    Another option is to use a different Terminal emulator, such as iTerm which also has the ability to close the window when the shell exits.  It can even automatically quit iterm when the last window is closed.

  • (SOLVED) Closing a terminal window

    When I am through using the terminal window, I hit the X at the top right corner but get this message: There is still a process running in this terminal. Closing the terminal will kill it.
    Why do I get this? I think I have nothing running. is there a bug?
    Last edited by mcduling (2011-12-19 22:23:54)

    It is complaining because you are still running su. That's a fair warning, not a bug.
    If you don't like it, use sudo instead. It's safer anyway than leaving a terminal sitting around in su-mode for arbitrary lengths of time.
    Edit: btw, if you have run su to gain root access, and you want to close the terminal, you can get out of su by typing "exit". Then you should be able to close the terminal.
    But really, don't use su. That's just asking for trouble. Sudo is your friend.
    Last edited by /dev/zero (2011-12-19 09:59:43)

  • 'Run' terminal window not closing

    I have an Java application which I have created an installation package for using InstallAnywhere.
    On Solaris when launching the application using the alias from a terminal window it works fine. But, when I launch the application from the File Manager, by double-clicking, it creates an 'extra' terminal window called 'Run', this terminal window doesn't terminate when I exit my application.
    How can I prevent this, can I prevent the 'Run' window from starting using some sort of setting, or can I somehow make sure it is closed togheter with the application?
    On Linux (SuSE10) the OS asks how I would like to run my application so I don't have the same problem there.

    Hi Kanwalpreet
    For basic idea please refer to the following link
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/dialog%20boxes%20in%20web%20dynpro%20applications.pdf">Dialog Boxes in WebDynpro</a>
    Go Through <b>page 16</b> of the PDF Document
    Regards
    Chaitanya.A

  • Terminal Window asking for password when opening

    I don't know what happens but everytime I open a terminal window its ask me for password. If I type my admin password it starts saying that can't found my ~ directory and starts in :/ instead of :~
    It is also showing ttys001 instead of 000 as usual.
    I don't know what it is, I think it have some relation with closing terminal windows without logging out of a ssh section, but I don't know how to resolve it. I tried reboot, "exit", delete com.apple.terminal
    Any sugestion?

    sgobin wrote:
    I don't know what happens but everytime I open a terminal window its ask me for password. If I type my admin password it starts saying that can't found my ~ directory and starts in :/ instead of :~
    It is also showing ttys001 instead of 000 as usual.
    I don't know what it is, I think it have some relation with closing terminal windows without logging out of a ssh section, but I don't know how to resolve it. I tried reboot, "exit", delete com.apple.terminal
    This is just a wild guess, but might there be a "sudo" command in a file in your home directory that's run when you launch a Terminal session, such as .bash_profile, .bash_login, or .profile? (This list assumes that you're using bash as your shell.)

  • Terminal window jumps on move

    If I have a terminal window open, am working in a different program, and I immediately move the terminal window, the terminal window will initially follow the pointer, and then it will jump back to the original position. It will then continue to move following the pointer, but will have a separation of anywhere between a fraction of an inch to several inches, depending on the speed of movement with my mouse.
    It is almost as though it jumps back.
    This will not happen if I change the focus back to terminal and then move the window.
    It happens even with multiple tabs.
    I can't find anything searching the web, so I decided to post.

    Hi game,
    I remember doing something like
    the stage.rect = the stage.rect
    prior to going to the new movie.
    HTH,
    Udo

  • Terminal window blinking cursor will not accept keyboard entry

    Have SunBlade100 w/ Solaris8.
    This is probably a dumb beginner question...
    When I enter certain commands at the terminal window - in this particular case
    # cat /dev/cua/a
    and I hit <return> the cursor skips to the next line, and
    continues blinking , and will not accept any keyboard entries.
    1. What is the significance of this? Is the cursor waiting further action, and if so, what?
    2. How do I get back to the prompt?
    3. Under this condition, is it safe to exit the terminal window by closing from the Window menu? (I can't type "exit" because the cursor won't accept keyboard entries, and Help for "closing the terminal" warns against closing from the Window menu because any background processes will not be terminated (and this may cause problems).
    Thanks in advance for any info on this.

    Thanks again for the info. <control>+C was exactly what I was looking for. It's coming back to me now-- the last time I had contact w/ UNIX was back in '85 at UC Berkeley (no GUI's back then!).
    I'm assuming that <control>+C is a graceful (i.e. relatively harmless way to exit the command.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • 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

  • How to open a terminal window in a path currently visible in the Finder?

    I often need to open a terminal window with the current visible folder (a long, deep path) as the working directory.
    In Windows I used to have the little "Open command window here..." hack available in the context menu in Explorer.
    How can I achieve the same on OS X to avoid tediously typing the path?

    open a finder window and navigate to one-level above
    this visible folder.
    open a terminal window.
    drag the folder of interest from the finder window
    into the terminal window. now you see the whole path
    to that folder has been typed out for you....
    so, if you wanted to 'cd' into that folder in
    terminal, you'd type cd, then a space, into the
    terminal window, then drag that folder in there from
    the finder, then hit return.... viola!
    If the folder you want is already open, you can drag the icon at the top of the Finder window. You don't have to go one level up.

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

  • Output to terminal window

    Is it possible to write chars to a standard terminal window (command prompt) at a given position? And with other colors?

    Hello Valdoran,
    since Java is (supposed to be) platform independant, it limits the functionality to what is available on most platforms. Many platforms's terminals support merely the methods System.out (PrintStream) provides. Therefore there is no print(int x, int y, Object message).
    Silver lining: The terminals which allow printing at a certain position mostly support ANSI escape sequences ^(1)^. So if you know you're (platform's) terminal supports it, give it a go..
    With kind regards
    Ben Schulz
    ^1^: http://en.wikipedia.org/wiki/ANSI_escape_code

Maybe you are looking for

  • How to find out where R/3 report data are stored

    Hy, I am new in BW. I have SAP R/3 report, I need to transfer that report data (all table data) to BW. Could You explain me step by step how i can do it? How to find out where data are stored? Thank you very much! Regards, Arunas

  • Iphone's not recongnised either on my iMac or my PC

    Hello, When i plug my iphone into both my Vaio and my iMac it's not regonised by iTunes now!! It charged well but no interacts what so ever with the computers. I try with several cable and on another iMac also. Can anybody help me please!! Thank you!

  • Paying company code house bank

    Hi, Following might be basic query. I have searched in SCN forum, but not found any solution. Paying company code is different and house banks of paying company code is given in ranking order. Please let me know how can I override the ranking order a

  • Copy of Sent Mail sent to InBox

    I rebuilt my SBS2011 server, which uses Exchange 2010 with Forefront 2010 and I'm using an Outlook 2013 (x64) mail client. Now any email I send appears in the Sent folder as expected, but a copy also appears in the InBox.  I can't find any obvious se

  • Receiving email from myself

    whenever i send a message it goes to the desired recipient but i also receive the same message from myself in the inbox. how do i change this?