0

I want to rapidly execute a remote command using ssh, for example ls -al /path/to/myfile. Unfortunately, I'm using tcsh rather than bash. My .cshrc file is quite long and slow, so I'd like to bypass it. If I were using bash, I could (presumably) run

ssh [email protected] "bash --noprofile --norc" < lsFile

where lsFile contained the ls command. But tcsh doesn't support either of these flags. Is there an alternative way to accomplish the same effect within the tcsh shell?

If not, an alternative would be to condition on something at the top of my .cshrc file and exit it prematurely. I can't simply condition on whether I have an ssh connection, because for most of my ssh connections, I want to run the full .cshrc file. So I'd need to send the conditioning token within this particular ssh command. Is this possible?

3
  • Which version and distro of Linux are you using?
    – user68186
    Commented Sep 10, 2021 at 20:18
  • man tcsh suggests the equivalent option is -f (The shell does not load any resource or startup files, or perform any command hashing, and thus starts faster.) Commented Sep 10, 2021 at 20:30
  • @user68186, I'm running ubuntu, 20.04. Here's the output of uname -a Linux 7420 5.13.0-1010-oem #11-Ubuntu SMP Wed Jul 28 13:04:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux Thanks @steeldriver, I don't know how I missed that. The command took 5 seconds instead of 7, which is something of an improvement!
    – Leo Simon
    Commented Sep 11, 2021 at 22:40

0

You must log in to answer this question.

Browse other questions tagged .