Can't rcmd with star name


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Can't rcmd with star name
# 1  
Old 08-02-2018
Can't rcmd with star name

We have had a script here for years used to send files to other computers or to rcmd a command entered thru a prompt. A file we are looking for on the other computers will start with the same characters followed by -nnnnnn.txt. I can log into another computer and find (or not) that file, but not with a rcmd. This is the relevant part of the script:
Code:
    read cmdname
    date >>/usr/tmp/fixit.x$tstamp
    echo "Running $cmdname" >>/usr/tmp/fixit.x$tstamp
    exec 9</usr/shells/remote.list
    while in=`line <&9`
    do
       echo $in
       echo $in >>/usr/tmp/fixit.x$tstamp
       set  $in
       in=$4
       rcmd $in $cmdname 2>&1 |tee -a /usr/tmp/fixit.x$tstamp
    done

A command like "ls -l /dir1/dir2/FILEONE-.*" doesn't work.

Any ideas? TIA This is a SCO machine but the remotes may be SCO or Linux.
# 2  
Old 08-02-2018
Saying a command doesn't work without telling us what happens and in what way it doesn't work leaves us with lots of things that we could imagine and nothing that we can base any realistic suggestions that might be able to solve your problem.

One might guess that the asterisk is being expanded to a list of files on your local machine by the shell that is collecting arguments before invoking rcmd in the loop. Are there files on your local machine that match the filename component when $cmdname is expanded? Are the files matched on the local machine the same files that would match if that pattern were expanded on each of the remote machines?
This User Gave Thanks to Don Cragun For This Post:
# 3  
Old 08-03-2018
This morning I tried it again with "ls -l /dir1/dir2/FILEONE*" and that shows up at the top of the log. If I sent it to bb123456, what comes back is
Code:
ls: /dir/dir2/FILEONE-998877.txt not found: No such file or directory (error 2)

That file does not exist on this computer--the remote computers compress it with other files to send it to us. That file does exist on bb998877, though.

I have tried enclosing the entire command in single quotes and double quotes in separate tests. What I get is
Code:
sh: ls /dir1/dir2/FILEONE*:not found

and at linux branches the "sh" is replaced by "bash".

Thanks for looking at it.
# 4  
Old 08-03-2018
Hold it. We all are just poking in the dark.

Please draw the entire picture, including sensible error messages. An execution log of the program run (set -x option) might be helpful.
Pls show
  • the meaning of "shows up at the top of the log"
  • the contents of /usr/shells/remote.list
  • the result / contents of in=$4
  • the meaning of -nnnnnn.txt
  • the meaning of bb123456 and bb998877
  • the files existing in the target directory on the targets node(s)

You may want to try to enclose the $cmdname in double quotes in the rcmd command.
These 3 Users Gave Thanks to RudiC For This Post:
# 5  
Old 08-03-2018
Just enclosed $cmdname in double quotes and it worked!

Many thanks!

Last edited by wbport; 08-03-2018 at 01:30 PM.. Reason: Tried suggestion
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Solaris

Star/Libre/Open/???-Office for Solaris 11.2 ?

It's been a few years since this topic was last asked and answered.. curious whether anyone knows if the landscape has improved? looking for a more modern release of OpenOffice / LibreOffice / etc than the OOo-3.3 version mentioned in earlier posts from 2012. Would prefer not to compile from... (1 Reply)
Discussion started by: Yeaboem
1 Replies

2. UNIX for Dummies Questions & Answers

How can I replace the lines that start with a star and replace it with numbers start from 1?

I need to replace the (*) in the fist of a list with numbers using sed for example > this file contain a list * linux * computers * labs * questions to >>>> this file contain a list 1. linux 2. computers 3. labs 4. questions (7 Replies)
Discussion started by: aalbazie
7 Replies

3. Red Hat

What is star

I am looking to take the Redhat Certification exam, and one of the guidelines is: Can someone tell me what star is? Thank you. (2 Replies)
Discussion started by: druidmatrix
2 Replies

4. What is on Your Mind?

Did you watch Super Star (Thalaivar's) Endhiran Movie?

Robot fever is there throughout the world ! :b: (3 Replies)
Discussion started by: matrixmadhan
3 Replies

5. Shell Programming and Scripting

parsing a STAR tag-value file

I have a recent file I am trying to parse that looks like this: value_one:1:value_two:2:value_three:3 value_one matches to 1 value_two matches to 2 value_three matches to 3 the semi-colons not only seperate the tags to their corresponding values, but also seperate tag/value pairs from... (2 Replies)
Discussion started by: mike@freddiemac
2 Replies
Login or Register to Ask a Question

Featured Tech Videos