Tag Info

Hot answers tagged

6

Use a heredoc: ssh host.domain.com /bin/bash << EOF big ugly commands lots of them EOF


4

Use key-based logins, not password-based. Then you can add a (list of) "forced command(s)" to your public ssh key (in the "options" field in case of SSH1) which is installed on the server (in ~/.ssh/authorized_keys file for SSH1, ~/.ssh2/authorization for SSH2). Make your forced command so that your desired shell is called... More: You can associate at ...


4

There is a case to be made that this behavior makes more sense (and I believe it's used by rsync, even on GNU/Linux). Consider the following case: mydir |-.fileA |-fileB The the semantics of these three specifiers are all different: cp -r mydir dest/ # creates dest/mydir, containing both files cp -r mydir/ dest/ # copies both files ...


4

From: man stty: NAME stty - change and print terminal line settings -- snip erase CHAR CHAR will erase the last character typed This means that ^H (Ctrl-H) will be configured as control sequence to eliminate the last typed character.


3

I don't believe this is possible, at least with openssh-based systems. If you have the ability, a better solution might be to sftp up a shell-script file, and then execute it with the method you posted. It would have the advantage of minimizing the amount of escaping needed, but would leave a file behind that would have to be removed (perhaps as the last ...


2

Without manually deleting the '/' appended in a default installation? Unfortunately not as stated on Apple's Darwin man page for cp is "If the source_file ends in a /, the contents of the directory are copied rather than the directory itself." So it appears it's part of the design of Darwin's cp. It is however possible to unset the addsuffix shell variable ...


2

You'll need to quote it: bash -c 'for i in 1 2 3 ; do echo $i ; done' In your example, the only command bash is running is "for" on its own.


2

You can use printf and single quotes to avoid variable expansion: printf '$' > myfile


2

A straight alias isn't going to work for this application. Something like this would come close, except what you would get is the output of the grep, not the jar filename: alias targrep="find . -name '*.jar' -exec jar tvf {} \; | grep" targrep someterm To get the filename, you should switch to using a function instead of an alias so that you have more ...


1

It means that LD_LIBRARY_PATH is not set in your env. Try setenv LD_LIBRARY_PATH .


1

This command: rm /root/.history should do what you're after, though it may be getting written back out when you logout. If you simply want history never stored, you could do this: echo > /root/.history chflags schg /root/.history which empties the file then sets it immutable.


1

Not 100% sure if HISTSIZE variable exists in (t)csh, but it might. So try with setenv HISTSIZE 0 rm -f /root/.history And see if it helps.


1

This might works for you too not sure for (t)csh shell history -w OR rm .bash_history


1

In tcsh setting autolist will cause tab completion to show a menu of options when the completion choice is ambiguous instead of just beeping at you and waiting for more input until an unambiguous completion is possible. From the tcsh man page: autolist (+) If set, possibilities are listed after an ambiguous completion. If set to `ambiguous', ...


1

Because tcsh needs a CR character at the end of the line to execute the command, which is missing in your first example. Just end every line in a shell script with the enter key to be on the safe side.


1

Shell variables can be set via the set command in (t)csh. set variable=value


1

That's just the GECOS field from the password file, so you could get it directly from there if you wanted to: grep -w $LOGNAME /etc/passwd|cut -f5 -d: If someone were using the GECOS field to store more than the full name, eg an office telephone number as well (as is permitted, but is no longer common), you'd need to run it through another cut to get only ...


1

getent passwd $LOGNAME | awk -F ":" '{print $5}' should be easier. The real name is called 'gecos'


1

A little bit of grepping gives me what I want. There is one thing I know for sure : the basename of the file (not the whole path). In my case, source_me.tcsh. So we can query lsof for the current shell PID and grep the absolute path. $$ gives you the PID. /usr/sbin/lsof +p $$ | grep -oE /.\*source_me.tcsh


1

You can try following, which should work in normal (t)csh. I do not know if it also works in the .(t)cshrc: #!/bin/csh set DUS = ( $_ ) #DUS: Dollar UnderScore set DNU = $0:q #DNU: Dollar NUll if (( $#DUS > 1 )) then if ("${DUS[1]}" == 'source' || "$DNU:t" == 'tcsh' || "$DNU:t" == 'csh') then set DNU = ${DUS[2]:q} endif endif echo 'Your script ...


1

I take it that this is output from ls, rather than tab-completion of shells? (I know at least one shell which can colourise shell tab-completions but you don't say, so I'll assume ls). Use $LS_COLORS, often initialised via the dircolors(1) command. dircolors -p to see the defaults, take the output from the two systems and diff. Drop the desired config ...


1

sh: unset COLUMNS LINES; export TERM=xterm csh: unsetenv COLUMNS LINES; setenv TERM xterm Terminals which have dynamic size or font or resolution are the norm, not the exception. When that became the case, Unix put this information into the kernel tty attributes, and deprecated $COLUMNS, $LINES, and the termcap/terminfo dimension data. You can see the ...


1

For tcsh or csh: set PATH = (. /usr/local/lib/play-1.1 $PATH)



Only top voted, non community-wiki answers of a minimum length are eligible