Terminal starts the last shell script

Hello,
I have problem with Terminal. It should start with normal shell prompt, but in my case it starts with the script I called the last time.
How it happened: I have created shell script called "logintoserver.sh", there is just "#!/bin/bash; ssh -Y -l someuser someserver". I have a link to this script on my desktop, so I can easily pop up a terminal session to my remote server.
OK, this works, but when I call application Terminal directly then, from Finder/Applications/Utilities/Terminal, it starts that "logintoserver" script again. Now I cannot get my local shell prompt. I can only follow login script and then ssh to my emac back from that remote server, but it's not that nice, you see...
I changed shell in Terminal preferences, no help. I believe there is some option "execute last command at the beginning of new session", but I can't find and disable it. When I delete this "logintoserver" script, all works OK. But I like to have one click login window.
Thanks for any kick,
David

Hi Tim,
thanks for your helpful info. Two questions:
when I login to my remote server (Tiger Server) via SSH, the command line on my laptop changes to reflect the server name Im logging into.
1. Laptop named "jimmydeuce" logs into 'margaritaserver' a Tiger Server via SSH
2. laptop closes SSH session to server
2. laptop now launches Terminal
3. laptop now sees prompt line restated as: margaritaserver:~ username$
how to get back to normal prompt: jimmydeuce:~ username$ ???
Cheers,
Chris Chamberlain

Similar Messages

  • Please help with executing the c-shell script by using the exe class

    I try to use the exec class to execute a c-shell script in my java gui program like this. But I don't get anything when clicking on the start button.
    here is my code:
    Runtime r = Runtime.getRuntime();
    r.exec("./DDMReportEvents");
    ./DDMReportEvents is the name of the c-shell script.

    I think Runtime.exec runs DOS batch files, but not Unix shell scripts.
    Try:
    r.exec("csh -c ./DDMReportEvents");
    to get the shell to run the shell script.

  • Hiding terminal window when running shell script?

    Hi,
    I've set up a shell script (myscript.command) to run an application with certain launch arguments. When I execute the script the app runs fine, but I get a residual terminal window.
    How can I hide it immediately after the app launch, or, preferably, avoid seeing it in the first place?
    Thanks!
    Guy

    A .command script is really just a data file for Terminal.app, which is why a terminal opens. One solution is to convert it to be its own .app (i.e., it would run on its own instead of being run by something else). I think platypus and dropscript are the two standard tools for doing that.

  • Problem with the run_job,shell script with sqlldr

    Hi Gurus,
    I Created a job which calls the shell script and i understood from the other posting this job is going to execute with nobody,
    I had done the below testing
    Test 1) Shell script calls the SQL file, this SQL file executes the procedure.
    Test 2) Shell script calls the sqlldr command.
    When i execute the Test cases with , dbms_scheduler Run_job procedure, Test1 is success but Test2 was failed
    When i execute the Test cases with, logging into box with owner of the shell & both test cases are successful.
    Parent folder & Shell files are given with 777 permissions. & the Oracle db is version 10.2.0.1.0.
    Error:
    STANDARD_ERROR="SQL*Loader-522: lfiopn failed for file (*.log)"
    Please provide me your inputs its bit urgent Thanks a lot for your help.
    Edited by: 926769 on May 23, 2012 2:27 PM

    First of all let's look at your environment ... a totally unpatched version of software that is so old it is in desupport mode. You should upgrade to a fully supported version but, if you can't, at least to 10.2.0.5.
    That said without seeing any of your code, or a listing showing permissions on the directory and files, there is insufficient information from which to help you.
    Please post ALL information required for us to understand what you are doing an your environment.
    But before I decided that NOBODY was doing anything ... I'd shell out to the server from SQL*Plus using the HOST command and verify that permissions are as you believe them to be. There is every reason to believe SQL*Loader is having an issue with your file as identified.

  • Fle import the unix shell script

    hi all
    I want to develop unix shell script & cron job to read ftp file and call an oracle procedure to import the data in an oracle database
    can any one tell me how to go about it ?
    also does any one have some documentation related to the topic
    plzzz help me
    mandar

    Hi,
    I want to develop unix shell script & cron job to read ftp file and call
    an oracle procedure to import the data in an oracle databaseYou can
    1/ use ftp to get the file to Oracle Instance host then call a Proc/Package that'll parse the file.
    2/ write/find on google a FTP package using UTL_TCP then create a procedure using the package to open the ftp file and parse it.
    You don't give much details on what the actual aim is, si I can't be more specific.
    can any one tell me how to go about it ?There might be other possibilities, describe what you want to achieve globally and we'll give you more advices.
    also does any one have some documentation related to the topicTahiti: http://tahiti.oracle.com
    maybe AskTom: http://asktom.oracle.com
    Regards,
    Yoann.

  • HT1212 when i put my itouch in recovery mode and i start the last update on itune, at the middle, the ipod restart and nothing work ...

    Hi
    First sorry for my english
    Last night, i got my ipod touch and i put a password on when i was watching a movie and with my badluck skill, i put a random password because i was distract Now, when i try to put the ipod in recovery mode and try to do the last patch, my ipod restart in the middle! After this, nothing work

    Try disabling the computer's antivirus and firewall.
    - Next try the manual install method of:
    iDevice Troubleshooting 101 :: iPhone, iPad, iPod touch
    Place the iPod in recovery mode after the firmware download is complete and then restore using the instructions in the article. Sometimes recovery mode timeouts and returns to disabled before the firmware download is complete.
    - Then try on another computer

  • When openning a PDF file, a new tab will open but it will be blank, it does not download or open any pdf files, this just started the last 3 days....!!!!

    Hi,
    I am on the verge of deleting Firefox from my computer as it has wasted hours of my time, and none of the online trouble-shooting answers are of any help.
    Until recently I could open PDF files in my browser window, and today its impossible to open any pdf file, it will not even download if I choose to download it.
    This issue has been going on and off for nearly a year, and I downloaded Nitro PDF add-on to solve it previously as the Adobe reader add-on didn't do anything. Today In the options menu of applications where I can select the program I want to open the PDF files with I can no longer find the NitroPDF reader as an option, so I choose the Adobe add-on and no matter how many re-starts it refuses to initiate any PDF files, all I get is a open and empty new tab.
    Internet explorer opens PDF files fine, so I know its not computer related.
    I am running Windows Vista Ultimate, Firefox Version 19.0.
    If there is a way of fixing this, please help because currently I am at the end of my patience.
    Regards,
    Emre

    Hey thanx for the help, it worked like a charm.
    I think firefox changed the application lay out, as I used to be able to choose my PDF opener from the list at " Adobe Acrobat Forms Document' where I could choose Nitro-PDF reader, but it has now moved all the way to the bottom like you suggested to the obvious place of "Portable Document Format" section.
    If someone didn't tell me , I wouldn't have scrolled all the way down to be able to find it... it really should be with all its cousins up the top...
    Cheers again..

  • Error starting the last available version of PC su...

    After installing when running pc suite I get this error
    The application failed to initialize properly (0x0150002). Click OK to terminate the aplication.
    I have never had this erro before.
    I have W xp sp2

    After sometime I discovered sme more information about this issue. After installing the lst PC Suite version I get an application error.
    nspecting Windows event log I have this four messages related with this:
    1) Dependent Assembly Microsoft.VC80.MFC could not be found and Last Error was The referenced assembly is not installed on your system.
    2)Resolve Partial Assembly failed for Microsoft.VC80.MFC.
    Reference error message: The referenced assembly is not installed on your system.
    3) Generate Activation Context failed for C:\Program Files\Nokia\Nokia PC Suite 7\PCSSupportSetup.DLL.
    Reference error message: The operation completed successfully.
    4) Application popup: PCSuite.exe - Application Error : The application failed to initialize properly (0xc0150002). Click on OK to terminate the application.
    Anyone can provide a solution?

  • Shell scripts and buttons

    i cannot figure out how to get a button made in interface builder/xcode to run/execute a simple shell script. how do i do it. say i made a regular push button named button and i wanted it to start the "fivemin" shell script i pasted in below. assume the shell script is in my path already, do i need to export the path again as well.
    also, my version of xcode is missing the shell script automator fron the new products options, is this a new thing.
    but i would rather do it in a cocoa app. please give me an example say with a timed loop so i can check to see the process running via ps
    ###name: fivemin
    #!/bin/bash
    # this shell script simply sleeps in $incr second intervals for
    # five minutes
    trap 'echo "fivemin: EXITING"' EXIT
    typeset -i nsecs=5*60 i=0 incr=4
    while [ $i -lt $nsecs ]; do
    sleep $incr
    ((i+=incr))
    done
    exit 0

    To wrap a unix tool you need to use NSTask. Here's a useful tutorial from CocoaDevCentral.
    If you're new to Cocoa as you say (in your other post), then I'd first recommend working through a couple of the basic tutorials knocking around to get an idea of the language and the tools available. Apple's own venerable 'Currency Converter' tutorial is here. MacDevCenter's also got quite a few here. You'll be able to find others on the web.
    My version of Xcode (2.1) has a 'Shell Script Automator Action' in the new project assistant, 'Action' section. I've no idea if this has changed in the latest versions, nor why yours might be missing it. The template used when creating it is located in /Application Support/Apple/Developer Tools/Project Templates/Action/Shell Script Automator Action/.
    Another solution that you might consider is using AppleScript Studio. This would use the 'do shell script' command from AppleScript and would use Interface Builder to create your window and button in a similar manner to a Cocoa version.

  • Executing shell scripts before the war is loaded

    I want to execute some shell scripts before my web application starts. I am using struts. One way is to execute these shell scripts is by executing them in a startup servlet which is loaded before action servlet is loaded. Am I right? Is there some other way. I am using Tomcat 5.0. Is there some way by which i can execute these shell scripts before my war is loaded in the tomcat. Actually it is possible that tomorrow i might have more shell scripts than i have today. In that case i do not want to modify the code. Thats the reason I am wondering if there is a way i can do this with the help of tomcat.

    thats right. So out of two ways, one, being having a startup servlet and second being the tomcat shell script change, which is the preferred way? Is there any other third way to achieve this?

  • The Shell script keeps hanging

    Hello,
    I have the following shell script and when i execute, it keeps hanging and nothing happens
    Please let me know.
    Requirement is to read data from file and pass it to the sql and create files as shown.
    code
    #!/bin/sh
    while read user.dat
    do
    echo "user = $1 email = $2"
    done
    sqlplus -S /NOLOG << EOF
    connect username/pwd@schema
    select user_name,count(*) from apps.fnd_user
    where 1=1 and user_name ('$1') and email_address ('$2')
    group by user_name;
    EOF
    if [ $? -ne 0 ]
    then
    % cat > user_exist
    else
    % cat > user_notexist
    fi
    exit 0
    Data File
    rsreenivasa null

    Well, youy have many problems here:
    while read user.dat
    do
    echo "user = $1 email = $2"
    done
    The "user.dat" string is an invalid variable name, so this loop never runs.
    Then, in this sequence:
    if  $? -ne 0
    then
    *% cat > user_exist*
    else
    *% cat > user_notexist*
    fi
    The cat(1) commands then copy stdin to either "user_exist" or "user_notexist".
    You don't show how you run this command, so we cannot tell what happens exactly.
    Please delete everything below the "while read ..." loop. Get that loop working as you expect it should. Then add a few more lines and test those. Build the shell script incrementally, debugging each as you go.
    Hint: since this is a shell script, run it like this:
    $ sh -x ./myscript arg1 arg2 ...
    to see what happens as it happens.
    Cheers

  • Why has the sql statement been extucted two times in shell script?

    I tried to test rac load balance using the following shell script on suse 10 + oracle 10g rac.
    oracle@SZDB:~> more load_balance.sh
    #!/bin/bash
    for i in {1..20}
    do
    echo $i
    sqlplus -S system/oracle@ORA10G <<EOF
    select instance_name from v\$instance;
    EOF
    sleep 1
    done
    exit 0After execute shell script, I got the follow result.
    oracle@SZDB:~> ./load_balance.sh
    1
    INSTANCE_NAME
    ora10g2
    INSTANCE_NAME
    ora10g2
    2
    INSTANCE_NAME
    ora10g1
    INSTANCE_NAME
    ora10g1
    3
    INSTANCE_NAME
    ora10g1
    INSTANCE_NAME
    ora10g1Seem the sql statement has been executed two times in each loop. If you feel free please help to have a look. Thanks in advance.
    Robinson

    You can end a SQL command in one of three ways:
    * with a semicolon (;)
    * with a slash (/) on a line by itself
    * with a blank line
    A semicolon (;) tells SQL*Plus that you want to run the current command that was entered. SQL*Plus processes the command and also stores the command in the SQL buffer.
    A blank line in a SQL statement or script tells SQL*Plus that you have finished entering the command, but do not want to run it yet, but it's stored the command on SQL Buffer.
    A slash (/) on a line by itself tells SQL*Plus that you wish to run the command stored on SQL buffer.

  • [SOLVED] advanced shell script for mount and unmount samba share

    Good morning guys,
    Today I've a very long question....
    Hope in your help....:
    I usually move from different network.
    For one of those I need to mount some share that are under an ActiveDirectory server.
    To do that I use samba.
    Especially I've made and use the below  shell script.
    I know that it's so stupid but I'm a very newbie:
    #!/bin/sh
    echo "This is a custom script for mount my citrix share"
    echo "Please insert user password (must a sudoer user)"
    echo " "
    sudo mount -t cifs -o username='myusername',password='mypassword' //host_ip/TsHome$/myusername /home/myuser/samba_share/TsHOME
    sudo mount -t cifs -o username='myusername',password='mypassword' "//host_ip/direction" /home/myuser/samba_share/direction
    echo " "
    read -p "Press ENTER key to close this terminal"
    exit
    As I say the script work but it's so crude...!
    I want/need to implement it whit the follow addictions:
    1. print a feedback on mount: somenthing like "TsHOME is now mounted" or "unable to mount TsHOME"
    2. check if the share are already mounted: to prevent accidentally multiple mount. If a share is already mounted I want to print something like "TsHOME is already mounted on /home/myuser/samba_share/TsHOME"
    3. ask for share password  (now it's in clear on script) - This is optinal
    4. un-mount the share before reboot or shutdown command. That because I've notice that If i reboot or shutdown without manually un-mount the share the step of unmounting network file system became very slow
    If it's no extremely difficult, can someone help me to write this script?
    I know that man exist but I'm not a programmer and it's so difficult for me approch it.
    Thank you in advance.
    Ale
    Last edited by Alexbit (2010-09-23 21:29:13)

    Thank you very (VERY) much!
    I've follow your information and.. it work!
    If can be usefull to other this is the complete script:
    #!/bin/sh
    echo "This is a custom script for mount citrix share"
    echo "****************************************"
    echo " "
    echo "Please insert domain password:"
    read -s mypassword
    echo " "
    echo "|checking mount state...in share are not mounted mount it!|"
    echo "+-------------------------------------------------------------------------+"
    if grep "TsHome" /etc/mtab &>/dev/null; then
    grep "TsHome" /etc/mtab | awk '{print "TsHome is already mounted on " $2}'
    else
    sudo mount -t cifs -o username='yourusername',password="$mypassword" //ipaddress/TsHome$ /home/Samba_share/TsHOME && echo "TsHOME is now mounted" || echo "unable to mount TsHOME"
    fi
    echo " "
    if grep "direction" /etc/mtab &>/dev/null; then
    grep "direction" /etc/mtab | awk '{print "direction is already mounted on " $2}'
    else
    sudo mount -t cifs -o username='yourusername',password="$mypassword" '//ipaddress/direction' /home/Samba_share/direction' && echo "direction pat is now mounted" || echo "unable to mount direction"
    fi
    echo " "
    if grep "Area" /etc/mtab &>/dev/null; then
    grep "Area" /etc/mtab | awk '{print "Area is already mounted on " $2}'
    else
    sudo mount -t cifs -o username='yourusername',password="$mypassword" '//ipaddress/Area' /home/Samba_share/Area && echo "Area is now mounted" || echo "unable to mount Area"
    fi
    echo " "
    echo "All DONE!"
    echo " "
    read -p "Press ENTER key to close this terminal"
    exit
    I don't really well understand what I've to put in rc.local.shutdown....
    I think somethings like:
    #!/bin/bash
    # /etc/rc.local.shutdown: Local shutdown script.
    echo "This is a custom script for UN-mount citrix share"
    echo "********************************************"
    echo " "
    echo "|check mount state: if mount then un-mount!|"
    echo "+-------------------------------------------------------+"
    echo " "
    if grep "TsHome" /etc/mtab &>/dev/null; then
    grep "TsHome" /etc/mtab | awk '{print "TsHome is NOT mounted -> going on..." $2}'
    else
    sudo umount /home/Samba_share/TsHOME && echo "TsHOME is now UN mounted" || echo "unable to UN-mount TsHOME"
    fi
    echo " "
    if grep "direction" /etc/mtab &>/dev/null; then
    grep "direction" /etc/mtab | awk '{print "direction is NOT mounted -> going on.." $2}'
    else
    sudo umount /home/Samba_share/direction && echo "direction is now UN mounted" || echo "unable to UN-mount direction pat"
    fi
    echo " "
    if grep "Area" /etc/mtab &>/dev/null; then
    grep "Area" /etc/mtab | awk '{print "Area is NOT mounted - Finished" $2}'
    else
    sudo umount /home/Samba_share/Area && echo "Area is now UN mounted" || echo "unable to UN-mount Area"
    fi
    echo " "
    echo "going shutdown"
    echo " "
    sleep 5
    I've try but it seems to ignore the IF statement... this is the output when ALL share are UNmounted:
    $ sh /etc/rc.local.shutdown
    This is a custom script for UN-mount citrix share
    |check mount state: if mount then un-mount!|
    +-------------------------------------------------------+
    umount: /home/Samba_share/TsHOME: not mounted
    unable to UN-mount TsHOME
    umount: /home/Samba_share/direction: not mounted
    unable to UN-mount direction
    umount: /home/Samba_share/Area: not mounted
    unable to UN-mount Area
    going shutdown
    Tomorrow I will test again when I'm at office.
    Meanwhile can you check if I made a macroscopic mistakes?
    Thank you again!
    Last edited by Alexbit (2010-09-23 17:34:49)

  • Help 'Exiting' after Automator Shell Script Execution

    Hello,
    I've recently installed and got running GCalDaemon (http://gcaldaemon.sourceforge.net/) which allows me to Synch Rainlendar <-> Google Calendar through iCal (You can also synch iCal <-> Google Calendar). I needed to start up a shell script/applescript after each startup/login in order for GCalDaemon to start the synching process each time and continue to do so at the timed intervals. I would do so by the following terminal code:
    cd /usr/local/sbin/GCALDaemon/bin
    ./standalone-start.sh
    I then tried automating this process and came across shell script execution through Automator. I did so and created a .app with the above mentioned code. This works and it starts up the necessary .sh file I need and the snyching works under StartUp. My concern is however, how do I exit terminal once the code has executed the necessary file? All I have in my .app is the above mentioned code for now. I just need it to exit terminal because on startup or after starting the program, I get this issue (See Attachment)
    This continues to run, so my guess is that I need to add code to exit terminal and allow the .app to close itself properly after doing so.
    Please guide me in the right direction.
    Picture Belows shows what happens when I run the Automator App. It continues to run until I quit out of the app manually (TheGCal programs works fine though). I feel I need to have app quit Terminal or fully end the process and quit out on it's own.
    Thanks
    <table style="width:auto;"><tr><td></td></tr><tr><td style="font-family:arial,sans-serif; font-size:11px; text-align:right">From GCalDaemon</td></tr></table>

    i redirected the command output to /dev/null which is unix equivalent of a black hole and I also redirected error output to standard output in case the script produces any errors.
    also & at the end tells it to continue without waiting for the script to finish.
    Message was edited by: V.K.

  • Trouble using Run Shell Script with python in Automator

    Hi. I have a python script I want to run in Automator (update_puzzles.py). All it does is check, rearrange and update files and there is not supposed to be any input. I can get the script to run outside of Automator, in Terminal, by navigating to the right directory and typing "python update_puzzles.py"
    I must not be setting up Run Shell Script correctly. I have it set to /bin/bash and Pass Input to stdin. The command line simply reads python /pathname/update_puzzles.py (where pathname is the path to the .py file, which I got by dragging the file onto the Run Shell Script command window). There are no actions before this in my workflow and the action after is View Results.
    The log says Run Shell Script failed, and the error is "Traceback (most recent call last):"
    Any suggestions?
    Thanks so much.

    If the script is expecting to do stuff with files in the same directory as the executable, you will probably need to add a statement to change to the appropriate working directory. The shell used in the Automator *Run Shell Script* action is a generic one that does not share any of the environment variables that the Terminal uses.

Maybe you are looking for

  • Ipod no longer recognised by pc

    hi my ipod was working fine then i installed my partners ipod mini & new ipod software on my pc and now itunes doesn't recognise my original ipod. it doesn't show up as a disk either. (it did however show up in the safely remove hardware list). most

  • Switching to simple to smartphone - what happens to upgrade?

    I have a question and I couldn't find a similar case online. Hope some of you can give me some light. I currently own a simple phone from Verizon and it is already eligible for an upgrade. I have been saving this upgrade for a while to go for the nex

  • How do you select multiple items in iPhoto?

    I insert my sd card into my mac and iphoto shows every single pictures in it. However, I just want to import a few different pictures but the only options were either select one or import all. I am pretty sure there is a way to select more than 1 pic

  • WCServer error

    I am using jdev 11.1.1..7 I get below stack trace when i try to run project <WebCenterConfig> <_createConfigMapSnapshot> An error occurred reading a service's configuration. oracle.adf.share.ADFShareException: java.lang.NullPointerException   at orac

  • Using System::ErrorDescription in Insert statement

    Hello, I want to insert System::ErrorDescription to store the error in the customized log table. When I use the following statement, it does not insert anything. What am i doing wrong. Please advice. create table dbo.load_err(load_err_id integer(PK),