tcsh

Check if a file is executable

折月煮酒 提交于 2019-11-27 00:45:34
问题 I am wondering what's the easiest way to check if a program is executable with bash, without executing it ? It should at least check whether the file has execute rights, and is of the same architecture (for example, not a windows executable or another unsupported architecture, not 64 bits if the system is 32 bits, ...) as the current system. 回答1: Take a look at the various test operators (this is for the test command itself, but the built-in BASH and TCSH tests are more or less the same). You

What do >! and >>! do in tcsh

会有一股神秘感。 提交于 2019-11-26 20:24:34
问题 In normal bash redirection > redirecting standard output to a file, overwriting when it exists and >> redirecting standard output to a file, appending when it exists. In a tcsh (c shell) script I found the operators >! >>! being used. What do this operators do? tcsh does also have the > and >> operators, so what is the difference? 回答1: In tcsh redirection the ! symbol means overwrite the existing file even if noclobber is set. In other words, if noclobber is set then: cmd > file will write

“Event not found” error for shell command in unix [duplicate]

ε祈祈猫儿з 提交于 2019-11-26 17:12:21
问题 This question already has answers here : echo “#!” fails — “event not found” (5 answers) Closed last year . when i am trying to remove consecutive duplicate lines with awk "!x[$0]++" file its reporting x[: Event not found. even the same case with sed -i -e "$!N; /^\(.*\)\n\1$/!P;D" file as well reporting N: Event not found. i tried with single quotes too, it didn't help Any idea to fix those 回答1: You're invoking the shell's history substitution. Surround the exclamation point with single

Is there an equivalent source command in Windows CMD as in bash or tcsh?

北城余情 提交于 2019-11-26 13:49:57
问题 I know that in the unix world, if you edit your .profile or .cshrc file, you can do a source ~/.profile or source ~/.cshrc to get the effect on your current session. If I changed something in the system variable on Windows, how can I have it effect the current command prompt session without exiting the command prompt session and opening another command prompt session? 回答1: I am afraid not, but you can start using Powershell, which does support dot sourcing. Since powershell window is really

How to determine the current shell I'm working on?

允我心安 提交于 2019-11-26 11:27:28
How can I determine the current shell I am working on? Would the output of the ps command alone be sufficient? How can this be done in different flavors of UNIX? DVK There are 3 approaches to finding the name of the current shell's executable: Please note that all 3 approaches can be fooled if the executable of the shell is /bin/sh but it's really a renamed bash , for example (which frequently happens). Thus your second question of whether ps output will do is answered with " not always ". echo $0 - will print the program name... which in the case of shell is the actual shell ps -ef | grep $$

Changing default shell in Linux [closed]

主宰稳场 提交于 2019-11-26 10:05:24
问题 How is it possible to change the default shell? The env command currently says: SHELL=/bin/tcsh and I want to change that to Bash. 回答1: Try linux command chsh . The detailed command is chsh -s /bin/bash . It will prompt you to enter your password. Your default login shell is /bin/bash now. You must log out and log back in to see this change. The following is quoted from man page: The chsh command changes the user login shell. This determines the name of the users initial login command. A

How to determine the current shell I'm working on?

社会主义新天地 提交于 2019-11-26 03:31:47
问题 How can I determine the current shell I am working on? Would the output of the ps command alone be sufficient? How can this be done in different flavors of UNIX? 回答1: There are 3 approaches to finding the name of the current shell's executable: Please note that all 3 approaches can be fooled if the executable of the shell is /bin/sh but it's really a renamed bash , for example (which frequently happens). Thus your second question of whether ps output will do is answered with " not always ".

Can a shell script set environment variables of the calling shell? [duplicate]

时光怂恿深爱的人放手 提交于 2019-11-26 01:22:06
问题 This question already has answers here : Can I export a variable to the environment from a bash script without sourcing it? (7 answers) Closed 8 months ago . I\'m trying to write a shell script that, when run, will set some environment variables that will stay set in the caller\'s shell. setenv FOO foo in csh/tcsh, or export FOO=foo in sh/bash only set it during the script\'s execution. I already know that source myscript will run the commands of the script rather than launching a new shell,