Re: script reports file not found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/16/07, Thufir <hawat.thufir@xxxxxxxxx> wrote:
Hi,

Basically, any and all feedback on this script appreciated.  It's doing
everything but the one, final task!   aaargh.  It claims that the file
isn't there, when it's kicking out the cat of the file in question.

Typo?  I don't think so, but maybe.  Other weirdness?  Maybe.

Also, I have everything on one line, which is, err, hard to read.  I'm
trying to learn ruby, but in the meantime am using an admittedly
primitive linux script to run some ruby stuff.  Yes, very ironic.  Here's
the data:

[thufir@localhost ~]$ ./run
/home/thufir
thufir
pwd ; whoami ; cat /home/thufir/run ; ls -al /home/thufir/dummy ; ruby /
home/thufir/dummy/script/generate scaffold dummy ; ./home/thufir/dummy/
script/generate controller hello index ; cat /home/thufir/dummy/views/
hello/world.rhtml ; cat /home/thufir/dummy/config/database.yml ; cat /
home/thufir/dummy/controllers/hello_controller.rb ; cat /home/thufir/
dummy/views/hello/world.rhtml ; date ; cat /home/thufir/dummy/script/
server ; ./home/thufir/dummy/script/server


Andreas answered your question (the ./home vs /home being your most
likely culprit, second possibility being as noted typo in the first
line of your script where it should be /bin/bash for a bash script).
In the meantime , why all the cat commands?  You can do a cat and
provide multiple file names (so one cat command). If you were pausing
between each to read I could see. But you are not. Simply running a
bunch of cat commands.

For example, instead of
cat file1; cat file2; cat file3
try
cat file1 file2 file3

What exactly is the goal of this script?  You have pwd and a ls
command, a few Ruby commands (it seems, I don't program in Ruby so I'm
guessing you are running a Ruby application) then all those cat
commands followed by a date command and then running a script again at
the end.  I'm guess they are there for trouble shooting, but I'm
guessing.

You are better off putting commands on different lines instead of all
on one (easier to read, easier to trouble shoot, easier to modify).

I gather you are posting here because you are running FC. But again as
Andreas noted, this is a Fedora list, so why post here?

You can e-mail me off list if you want some help with the bash script syntax.

Jacques B.

Jacques B.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux