How does a Script look like ?

Hi,

I’m very new to work with QNX (or any UNIXlike-System)
So I will ask some very nooplike question:::

What file-ending does a qnx-script have ?
In DOS it is .bat.
So what is it in QNX

Does anyone have a simple Scriptfile to download, doing some easy things like saying Hello to the User and renaming a file ?

You can write a shell script, and call it anything you like. Poeple usually use .sh because it is a shell, but that’s not a must.

eg: if you create a “hello.sh” like this:

#!/bin/sh
echo “Hello World”

You need to make sure the file is executable:
chmod a+x hello.sh

Now you can execute/run it.

hello.sh (or ./hello.sh if you get a “not found” error).

You need to buy a shell programming book.

THX for answering my question

I wrote the simple script as you said to me:

#!/bin/sh
echo "Hello World"

then I load it up via FTP and opened a connection via Telnet:

this is the log:


Welcome to QNX 4.25
Copyright (c) QNX Software Systems Ltd. 1982,1998
login: root
/>cd RAMDrv
/RAMDrv>ls -l
total 20
drwxrwxr-x  4 root      root           2048 Jan 01 00:19 .
drwxrwxr-x  4 root      root           2048 Jan 01 00:19 ..
-r--r--r--  1 root      root           1024 Jan 01 00:10 .bitmap
-r--r--r--  1 root      root            512 Jan 01 00:10 .inodes
-rw-r--r--  1 root      root             29 Jan 01 00:19 hello.sh
drwxrwxrwx  4 root      root           4096 Jan 01 00:10 usr
/RAMDrv>chmod a+x hello.sh
/RAMDrv>ls -l
total 20
drwxrwxr-x  4 root      root           2048 Jan 01 00:19 .
drwxrwxr-x  4 root      root           2048 Jan 01 00:19 ..
-r--r--r--  1 root      root           1024 Jan 01 00:10 .bitmap
-r--r--r--  1 root      root            512 Jan 01 00:10 .inodes
-rwxr-xr-x  1 root      root             29 Jan 01 00:19 hello.sh
drwxrwxrwx  4 root      root           4096 Jan 01 00:10 usr
/RAMDrv>hello.sh
hello.sh: No such file or directory
/RAMDrv>

It seems like it wount find the bin/sh
i checked the bin folder and found it

so can anyone imagine whats wrong ?

I’ll check the unversitys library for a book about unix-systems and shell-scripting the next days
Bothering you with stupid questions is not my intetion ;)

with you load it with ftp, which directory you put it?
you need to “cd” to that same directory under your telnet session.

its the same directoy

but i got an idea on my one

i edited the script on a win32 machine
so it is possible that i got a Carriage Return Sign at the end of every line

maybe this is confusing qnx

ok, that’s it
now it works

i think this is a failure everyone has to make just to learn it the hard way =)