Sponsored Content
Top Forums Shell Programming and Scripting command substitution problems with csh using grep Post 95742 by zazzybob on Saturday 14th of January 2006 06:39:54 AM
Old 01-14-2006
The prompt variable is csh's equivalent of PS1.

PS1 is the primary prompt for Bourne-based shells.

When you run your ps command at the command line, you'll see that there is a "?" somewhere in the output. This is confusing csh.

Before you call the ps command in your script, include the line:

set nonomatch

Then it should work. Personally, I'd say ditch csh and use a Bourne-based shell for scripting.

Cheers
ZB
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed substitution problems

Hi falks, I need to substitute in my ksh program, parameter (full path of directory) ,which is sent from outside program, with another parameter (another full path of directory) ,which is known and validated inside my program. I tried to use "sed" ,but i failed. For example: ... (2 Replies)
Discussion started by: nir_s
2 Replies

2. Shell Programming and Scripting

word substitution in csh

I have data that looks something like this: term1/term2/2005-12-01 13:20:30/term4 I need to make it look like this: term1/term2/20051201132030/term4 I am using a csh script. I have tried to do it by first converting the date/time to the format in which I want it, and then replacing it... (1 Reply)
Discussion started by: oprestol
1 Replies

3. Shell Programming and Scripting

AWK in CSH script problems

Hello Guys, I was trying to obtain the information from the /etc/passwd file, here was my script: 38 echo -n "What's your login name? " 39 set logname=$< 40 echo "Your login name is $logname, your user's ID is `grep $logname /etc/passwd|awk -F: '{print $3}'`" 41 echo " Your home dir is... (1 Reply)
Discussion started by: tpltp
1 Replies

4. Shell Programming and Scripting

Array problems in CSH

Hi all, I want to use some commands and I wrap them into an array, like follows: set ALIAS_AR = ( "ls -ltr|wc -l" \ "ps -ef|grep -v grep |grep tty|wc -l" \ "who|wc -l" ) Then I use a while loop to call every step: set no = 1... (3 Replies)
Discussion started by: tpltp
3 Replies

5. Shell Programming and Scripting

Cannot compare argument in if statement in csh/grep command if argument starts with “-“

If ($argv == “-debug”) then Echo “in loop” Endif But this is not working. If I modify this code and remove “-“, then it works. Similarly I am getting problem using grep command also Grep “-debug” Filename Can someone please help me on how to resolve these... (1 Reply)
Discussion started by: sarbjit
1 Replies

6. Shell Programming and Scripting

Execution problems with grep command in scripting

Hi All, I was looking for grep command option which can exactly matches the word in a file, for examples you may be seeing one word that is also in another word, there might be lkk0lv23 and a lkk0lv234 in which case lkk0lv23 will put BOTH hosts from the grep in. I was using this in a bash... (2 Replies)
Discussion started by: bobby320
2 Replies

7. Shell Programming and Scripting

Problems with substitution between two variables

To all geeks, What I want to achieve: 1. Accept two filenames from user and store the filenames in two variables (FILE1 and FILE2) 2. Check if files exisits. If doesn't, then exit 3. If files exist, look for a particular string in both files 4. If the string exists, then change the... (8 Replies)
Discussion started by: Deepak Tulsani
8 Replies

8. Shell Programming and Scripting

csh grep analog

Hi everyone, I'm trying to make a csh script analog for grep. I need to run through the directory which is arg, find a word (arg) in the files, and echo their names. Here's what I got if ($#argv != 2) then echo "Usage: $0 directory word" echo "Shows files which contains words" exit... (3 Replies)
Discussion started by: vanguardua
3 Replies

9. Shell Programming and Scripting

Substitution after using grep

Hallo Team, I would like to edit my output(files) after using grep manipulation. this is how my code looks like: grep Originating *2013*|grep -v "ACCOUNT IN RECALC"|grep -v MOBIFIN-TRANSIT|grep -v ",Call Forward Not Reachable"|grep "Unclear scenario:On-net to Off-net PGW, On-net to Off-net... (8 Replies)
Discussion started by: kekanap
8 Replies

10. Shell Programming and Scripting

Bash script having variable substitution problems

Hi I am setting the variables like this : setenv MODULE1 modem5__3 setenv MODULE2 modem5__2 setenv MODULE3 modem_ctrl_1_1 setenv MODULE4 modem_1_0 setenv COUNT 10 I am having a bash script as shown below ################################################ #!/bin/bash for ((... (5 Replies)
Discussion started by: kshitij
5 Replies
SCRIPT(1)						    BSD General Commands Manual 						 SCRIPT(1)

NAME
script -- make typescript of terminal session SYNOPSIS
script [-adfpqr] [-c command] [file] DESCRIPTION
script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1). If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the file typescript. Option: -a Append the output to file or typescript, retaining the prior contents. -c command Run the named command instead of the shell. Useful for capturing the output of a program that behaves differently when associated with a tty. -d When playing back a session with the -p flag, don't sleep between records when playing back a timestamped session. -f Flush output after each write. This is useful for watching the script output in real time. -p Play back a session recorded with the -r flag in real time. -q Be quiet, and don't output started and ended lines. -r Record a session with input, output, and timestamping. The script ends when the forked shell exits (a control-D to exit the Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not set) for the C-shell, csh(1)). Certain interactive commands, such as vi(1), create garbage in the typescript file. script works best with commands that do not manipulate the screen, the results are meant to emulate a hardcopy terminal. ENVIRONMENT
The following environment variable is used by script: SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most shells set this variable automatically). SEE ALSO
csh(1) (for the history mechanism). HISTORY
The script command appeared in 3.0BSD. BUGS
script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects. BSD
October 17, 2009 BSD
All times are GMT -4. The time now is 08:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy