Hi all, I'm new to shell script
i wrote some shell script for my colleague, everyone is fine,except on user
we are using VNC viewer to work
and there are some script start with shebang #! /bin/csh
there is an user will not terminate after running the script even if a hello world
i need to ctrl+c to stop the script manually
Below is my hello world
#! /bin/csh
echo "Hello World! \a \n"
exit 0
but if i modify the shebang to
"#! /bin/csh -f"
it works , and could be terminated normally
I google it and I know that -f means fast , it will ignore the .cshrc and .login
but I tried to remove the .cshrc in his home directory,it still wont be terminated and there's no .login in his home directory
So how can I make user can normally use my script without modify my shebang ?
You spoiled the shebang when you added the leading double quote, so the script will be executed with your user's default shell.
On the other hand, I can't see why the first scriptlet should not terminate on exit 0 without a <CTRL>C , be it run with csh or any other shell (although I'm definitely NOT a csh er)
There's nothing in the O/Ps post to suggest his echo is "looping".
The -X wouldn't add any debug output to the parent shell and wouldn't be needed were it so obviously looping
The O/P already stated that the startup scripts were removed
Why would the same scripts behave differently between users?
More information from the O/P needed for clarification, I would say. Such as why would you "VNC" to run a script in the first place? Really VNC or, perhaps VPN via a terminal emulator? Some terminal emulators don't close when the running command (or script) exits, by default, and might require some action on the (client) user's part.