Sponsored Content
Full Discussion: Help in tcsh script
Top Forums Shell Programming and Scripting Help in tcsh script Post 302687849 by nrjrasaxena on Friday 17th of August 2012 06:50:42 AM
Old 08-17-2012
Quote:
Originally Posted by mirni
Just change the first line to a different shebang:
Code:
#!/bin/bash

or
Code:
#!/bin/sh

for bourne shell.
Unfortunately, I did not help.
I wrote the test script in my laptop with bash SHELL. and when I shifted it to the remote machine. It failed to work.
Actually, those machine are not usual one and the default environment settings pick the tcsh shell.
So I started from scratch and tryign to make it work it for tcsh.

Thanks,
Pooja
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to call a perl script from tcsh?

Hi I am not sure how to call a perl script from a tcsh shell. do i need to set any environment variables? your help is appreciated Thanks (1 Reply)
Discussion started by: megastar
1 Replies

2. Shell Programming and Scripting

Help me with this tcsh script.!!!!

I need to write a tcsh script which would compare files in the two folders and then send me a mail saying which of the files are missing.For eg 1) I have this folder1 containing all the files which must land on folder2 on a daily basis. 2) If a file is present in folder1 but not in... (6 Replies)
Discussion started by: kumarsaravana_s
6 Replies

3. Shell Programming and Scripting

tcsh I can't get script to work :(

I have an export utility that exports documents from the native file to text. This is the way I would run it from the command line: expage "file" > "file.txt I am trying to loop through all the documents in the directory and expage them, here is the code: #!/usr/bin/env tcsh foreach file... (8 Replies)
Discussion started by: Fred Goldman
8 Replies

4. Programming

help wid C-script in tcsh

Hello Freinds I have just started off with Unix (TCSH) although I have a pretty sound background with C-programming. Kindly convey any error in foll script. #include<stdio.h> #include<math.h> #define PI 3.142857 main () { float r, A; printf("Enter the value of radius: "); scanf(" %f... (12 Replies)
Discussion started by: mahendrakamath
12 Replies

5. Shell Programming and Scripting

tcsh: not run script (if: Badly formed number)

Hello I have Linux Debian & tcsh shell. My mini script not run :(. Startup script displays a message: user@host:dir% ./test if: Badly formed number. script: #!/bin/tcsh -f #script check size files systems set x = `df -h /usr | tail -n1 | awk '{ print( $5 ); }'` set y = 60% if ($x... (5 Replies)
Discussion started by: moskovets
5 Replies

6. Shell Programming and Scripting

Help with gawk array, loop in tcsh script

Hi, I'm trying to break a large csv file into smaller files and use unique values for the file names. The shell script i'm using is tcsh and i'm after a gawk one-liner to get the desired outcome. To keep things simple I have the following example with the desired output. fruitlist.csv apples... (6 Replies)
Discussion started by: theflamingmoe
6 Replies

7. Shell Programming and Scripting

[Basic Query]bsh script in tcsh shell

I am a beginner (Just 2 days old:o ), i will really appreciate if you can solve my silly queries as below: Lets say i write a script like this #!/bin/bsh clear #to read name from keyboard echo "your name please.." read fname echo "you just entered $fname" exit 0 My environment is... (2 Replies)
Discussion started by: animesharma
2 Replies

8. Shell Programming and Scripting

tcsh env setting using shell script

Hi All, I have made a file file usercreate.sh & it has to run in tcsh env & needs some path to be set. my script is as below. ########################## #!/bin/csh setenv PATH "/usr/lib/java/class" setenv LD_LIBRARAY_PATH ########################### but when i am ruuning my script... (1 Reply)
Discussion started by: ajaincv
1 Replies

9. Shell Programming and Scripting

Tcsh complete (autocomplete) script

I cant figure out how the complete function works in tcsh. 1. I whould like it to complete after writing my_program.py with either start or stop. I have tried to do something like this in .cshrc.user: complete my_program.py \ 'c/start/' \ 'c/stop/' However i cant get it to... (1 Reply)
Discussion started by: mr_cad
1 Replies

10. Shell Programming and Scripting

Regular expressions in tcsh script

Hi, I have a shell script in tcsh to which I pass an argument, the length of which can vary. The possible values of the argument are the letters -c,s,i,q,a. and also a combination of these letters. (e.g: cs,si,ca,iq,qa,csq,acs,csia ..etc). The order of the letters does not matter. My problem... (2 Replies)
Discussion started by: Vaisakh P
2 Replies
runat(1)							   User Commands							  runat(1)

NAME
runat - execute command in extended attribute name space SYNOPSIS
/usr/bin/runat file [command] DESCRIPTION
The runat utility is used to execute shell commands in a file's hidden attribute directory. Effectively, this utility changes the current working directory to be the hidden attribute directory associated with the file argument and then executes the specified command in the bourne shell (/bin/sh). If no command argument is provided, an interactive shell is spawned. The environment variable $SHELL defines the shell to be spawned. If this variable is undefined, the default shell, /bin/sh, is used. The file argument can be any file, including a directory, that can support extended attributes. It is not necessary that this file have any attributes, or be prepared in any way, before invoking the runat command. OPERANDS
The following operands are supported: file Any file, including a directory, that can support extended attributes. command The command to be executed in an attribute directory. ERRORS
A non-zero exit status will be returned if runat cannot access the file argument, or the file argument does not support extended attributes. USAGE
See fsattr(5) for a detailed description of extended file attributes. The process context created by the runat command has its current working directory set to the hidden directory containing the file's extended attributes. The parent of this directory (the ".." entry) always refers to the file provided on the command line. As such, it may not be a directory. Therefore, commands (such as pwd) that depend upon the parent entry being well-formed (that is, referring to a direc- tory) may fail. In the absence of the command argument, runat will spawn a new interactive shell with its current working directory set to be the provided file's hidden attribute directory. Notice that some shells (such as zsh and tcsh) are not well behaved when the directory parent is not a directory, as described above. These shells should not be used with runat. EXAMPLES
Example 1: Using runat to list extended attributes on a file example% runat file.1 ls -l example% runat file.1 ls Example 2: Creating extended attributes example% runat file.2 cp /tmp/attrdata attr.1 example% runat file.2 cat /tmp/attrdata > attr.1 Example 3: Copying an attribute from one file to another example% runat file.2 cat attr.1 | runat file.1 "cat > attr.1" Example 4: Using runat to spawn an interactive shell example% runat file.3 /bin/sh This spawns a new shell in the attribute directory for file.3. Notice that the shell will not be able to determine what your current direc- tory is. To leave the attribute directory, either exit the spawned shell or change directory (cd) using an absolute path. Recommended methods for performing basic attribute operations: display runat file ls [options] read runat file cat attribute create/modify runat file cp absolute-file-path attribute delete runat file rm attribute permission changes runat file chmod mode attribute runat file chgrp group attribute runat file chown owner attribute interactive shell runat file /bin/sh or set your $SHELL to /bin/sh and runat file The above list includes commands that are known to work with runat. While many other commands may work, there is no guarantee that any beyond this list will work. Any command that relies on being able to determine its current working directory is likely to fail. Examples of such commands follow: Example 5: Using man in an attribute directory example% runat file.1 man runat getcwd: Not a directory Example 6: Spawning a tcsh shell in an attribute directory example% runat file.3 /usr/bin/tcsh tcsh: Not a directory tcsh: Trying to start from "/home/user" A new tcsh shell has been spawned with the current working directory set to the user's home directory. Example 7: Spawning a zsh shell in an attribute directory example% runat file.3 /usr/bin/zsh example% While the command appears to have worked, zsh has actually just changed the current working directory to '/'. This can be seen by using /bin/pwd: example% /bin/pwd / ENVIRONMENT VARIABLES
SHELL Specifies the command shell to be invoked by runat. EXIT STATUS
The following exit values are returned: 125 The attribute directory of the file referenced by the file argument cannot be accessed. 126 The exec of the provided command argument failed. Otherwise, the exit status returned is the exit status of the shell invoked to execute the provided command. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
open(2), attributes(5), fsattr(5) NOTES
It is not always obvious why a command fails in runat when it is unable to determine the current working directory. The errors resulting can be confusing and ambiguous (see the tcsh and zsh examples above). SunOS 5.10 22 Jun 2001 runat(1)
All times are GMT -4. The time now is 04:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy