LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   script doesn't perform the same as task done by hand (https://www.linuxquestions.org/questions/linux-server-73/script-doesnt-perform-the-same-as-task-done-by-hand-715784/)

bradvan 03-31-2009 08:51 AM

script doesn't perform the same as task done by hand
 
Good Morning,

I've written a script to enable console access through the serial port for a RHEL 5 installation. Everything works fine except for changing what systty points to. If I run the script, systty doesn't change. If I do the tasks by hand, it works. Any ideas?

Here is the portion of the script:
Code:

#!/bin/sh
DATE=`/bin/date +'%d%b%y'`
cd /etc/makedev.d
FIL=`grep systty * | cut -d: -f1`
sed -i.${DATE} 's/^\(ls*systty\s*\)0$/\1S0/' ${FIL}
cd /dev
rm systty
./MAKEDEV systty

The file is changed as expected, but systty doesn't point to ttyS0.

fpmurphy 03-31-2009 09:32 AM

Add full pathnames to everything and try the script again.

bradvan 03-31-2009 10:00 AM

It does. I just didn't type them all in. The file in /etc/makedev.d gets edited and looks fine. But when I run /dev/MAKEDEV systty it doesn't point to ttyS0. Just a tad frustrating. :)

When I do a diff on the file I see:

diff 01linux-2.6.x 01linux-2.6.x.30Mar09
< l systty ttyS0
---
> l systty tty0


All times are GMT -5. The time now is 02:35 PM.