csh

Move files that are 30 minutes old

前提是你 提交于 2019-11-28 00:49:20
问题 I work on a server system that does not allow me to store files more than 50 gigabytes. My application takes 20 minutes to generate a file. Is there any way whereby I can move all the files that are more than 30 minutes old from source to destination? I tried rsync : rsync -avP source/folder/ user@destiantionIp:dest/folder but this does not remove the files from my server and hence the storage limit fails. Secondly, if I use the mv command, the files that are still getting generated also move

How can I echo commands in a tcsh script?

吃可爱长大的小学妹 提交于 2019-11-27 17:27:19
问题 Yes. I know I shouldn't be using it for scripting. Yes. It is rubbish. I am indeed a fool. Nevertheless. I'd like to see the commands the script is executing, for debugging purposes. I think you get this effect with set -x or set -v in bash scripts. So e.g., if the script were #!/bin/tcsh echo "Hello" then when it ran, I'd see echo "Hello" Hello 回答1: Put: set echo and/or set verbose at the top of your script. That will print out everything that happens in your script and are equivalent to the

Explain the deviousness of the Perl “preamble”

有些话、适合烂在心里 提交于 2019-11-27 14:23:48
The Perl manual describes a totally devious construct that will work under any of csh, sh, or Perl, such as the following : eval '(exit $?0)' && eval 'exec perl -wS $0 ${1+"$@"}' & eval 'exec /usr/bin/perl -wS $0 $argv:q' if $running_under_some_shell; Devious indeed... can someone please explain in detail how this works? The idea is that those three lines do 3 different things if they're evaluated in a standard Bourne shell (sh), a C shell (csh), or Perl. This hack is only needed on systems that don't support specifying an interpreter name using a #! line at the start of a script. If you

How to replace a path with another path in sed?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 14:16:50
I have a csh script (although I can change languages if it has any relevance) where I have to: sed s/AAA/BBB/ file The problem is that AAA and BBB are paths, and so contain '/'. AAA is fixed, so I can say: sed s/\\\/A\\\/A\\\A/BBB/ file However, BBB is based on variables, including $PWD. How do I escape the '/' in $PWD? OR is there some other way I should be doing this entirely? Lev Levitsky sed can use any separator instead of / in the s command. Just use something that is not encountered in your paths: s+AAA+BBB+ and so on. Alternatively (and if you don't want to guess), you can pre-process

Redirect stderr to stdout in C shell

别等时光非礼了梦想. 提交于 2019-11-27 11:17:55
When I run the following command in csh , I got nothing, but it works in bash , is there any equivalent in csh which can redirect the standard error to standard out? somecommand 2>&1 The csh shell has never been known for its extensive ability to manipulate file handles in the redirection process. You can redirect both standard output and error to a file with: xxx >& filename but that's not quite what you were after, redirecting standard error to the current standard output. However, if your underlying operating system exposes the standard output of a process in the file system (as Linux does

Extract one word after a specific word on the same line

≡放荡痞女 提交于 2019-11-26 21:05:19
How can I extract a word that comes after a specific word in Linux (csh)? More precisely, I have a file which has a single line which looks like this: [some useless data] --pe_cnt 100 --rd_cnt 1000 [some more data] I want to extract the number 100 which is after the --pe_cnt word. I cannot use sed as that works only if you want to extract an entire line. Maybe I can use awk? Also, I have multiple files that have different values instead of 100 so I need something that extracts the value but doesn't depend on the value. With awk : awk '{for(i=1;i<=NF;i++) if ($i=="--pe_cnt") print $(i+1)}'

Setting stacksize in a python script

我怕爱的太早我们不能终老 提交于 2019-11-26 20:46:01
I am converting a csh script to a python script. The script calls a memory-intensive executable which requires a very large stack, so the csh script sets the stacksize to unlimited: limit stacksize unlimited When I try to reproduce this script in python, I execute them in a very naive manner, using os.system , e.g.: os.system('some_executable') But I do not know how to tell the OS to run these executables with unlimited stacksize. Is there a way to specify stacksize for calls within a python script? Is there some low-level system call that I should be using? And is there a module (similar to

Maximum length of command line argument that can be passed to SQL*Plus?

六月ゝ 毕业季﹏ 提交于 2019-11-26 20:07:43
I am calling SQL*Plus from Linux C Shell: sqlplus username/password @file.sql var1 var2 var3 If I pass a string as var1 , how long can this string be? Is it governed by the OS? In this case: Linux version 2.6.9-100.ELsmp (mockbuild@x86-010.build.bos.redhat.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-11)) #1 SMP Tue Feb 1 12:17:32 EST 2011 Update: Empirical testing yielded the following results: A command line argument of 5200 characters gave the error, "Word too long." 1300 characters then produced the SQL*Plus error, "string beginning "(000796384..." is too long. maximum size is 239

Explain the deviousness of the Perl “preamble”

我怕爱的太早我们不能终老 提交于 2019-11-26 16:44:10
问题 The Perl manual describes a totally devious construct that will work under any of csh, sh, or Perl, such as the following : eval '(exit $?0)' && eval 'exec perl -wS $0 ${1+"$@"}' & eval 'exec /usr/bin/perl -wS $0 $argv:q' if $running_under_some_shell; Devious indeed... can someone please explain in detail how this works? 回答1: The idea is that those three lines do 3 different things if they're evaluated in a standard Bourne shell (sh), a C shell (csh), or Perl. This hack is only needed on

how to source a csh script in bash to set the environment [closed]

旧巷老猫 提交于 2019-11-26 16:10:52
问题 We have Oracle running on Solaris, and the shell is by default csh. So the login script sets the oracle_home, oracle_sid in csh also. But I don't like csh and want to use bash to do my work. So how to source the csh login script in bash? e.g, the following is what in the .cshrc file. And when use bash, I'd like use these variables. One way is to copy the variables again and use bash command, such as export ORACLE_SID=TEST. But doing so will require us to maintain two copies of the files. And