Very simple argument in scripting question


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Very simple argument in scripting question
# 1  
Old 03-26-2007
Data Very simple argument in scripting question

I tried to do a search, but it couldnt pinpoint what my answer since using limited but broad keywords. Sorry in advance ; ;

Im limited to using Bourne shell scripting only, atm I have the following code (just the heading part of it)


Code:
...
...
# VARIABLE DECLARATION
# ====================

lineCount=1
eofFlag=0
matched=0

# Ask for player name

echo -n "Player name? "       # < problems with this
# and store it to the variable
read srcStr
...
...

read -n1 keyPress                # < problems with this

...
...

first my echo is showing the -n, and second my read is giving me "is not an identifier" error msg. I tried both echo -n and read -n1 in plain shell environment (non-scripting) and it works fine. But why it wont work when i put them in scripting file. And what are my alternatives?

Thanks for any help.... Couldnt find any answer to my question in google, and I'm stuck and desperate. Smilie
# 2  
Old 03-27-2007
Hi,
If possible can you post the full source....atleast from first line of ur script till the line where you get the first error..
I can take a look into it.

Thanks
Raghuram
# 3  
Old 03-27-2007
yes as raghram said pasting full source will help.
The echo is printing -n on screen means you dont have -n option available so you can use \c(escape seq) to solve the same prob.
Code:
echo "this is test\c"
read x

will do same as
Code:
echo -n "this is test"
read x

pls note read -n option is available with ksh shell and echo -n is with csh.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Syslog.conf: looking for a simple answer on a simple question

Cheers! In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not? To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies

2. Shell Programming and Scripting

Expect Scripting Loop Argument Desperately Needed!

I am trying to create an Expect script that does the following: 1) Telnets to an IP address and logs in with user ID and Password 2) Issue a CLI command to the server that will output data of which I am particularly interested in a DS1 clock 'Slips' value. I want to be able to keep issuing... (0 Replies)
Discussion started by: dwightlaidler
0 Replies

3. UNIX for Dummies Questions & Answers

help with shell scripting argument

#!/bin/bash echo "enter a file or directory name" read name if then echo " argument is file " ls -l $name | awk '{print $1,}' elif echo " argument is a directory" ls -l $name | awk '{print $1}' fi what i am trying to do. get input... (3 Replies)
Discussion started by: iluvsushi
3 Replies

4. Shell Programming and Scripting

Help :: Simple Shell Scripting

Hello, I want to find the "IP-OF-SERVER" in /etc/squid/squid.conf And replace it with The IP of server. I know this command returns the IP of server : ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}' And I can replace with sed. : sed -i... (4 Replies)
Discussion started by: Ghadamyari
4 Replies

5. Shell Programming and Scripting

Simple scripting.

echo "what is your username?" read username echo $username echo /home/$username $backup="backup" $restore="restore" # # if then echo "No username provided" else echo "hi $username would you like to backup or restore?" read userrequest echo $userrequest if then ... (4 Replies)
Discussion started by: EwanD
4 Replies

6. Shell Programming and Scripting

help with simple korn scripting

Hi, The logic is very simple but I can't seem to make this work in Korn shell. I need to check two files to make sure there is no errors. Each of the file will have number. For example, first file btt.txt will have 112 which is good. Second file bgg.txt will have 6 which is also good. If I... (4 Replies)
Discussion started by: samnyc
4 Replies

7. Shell Programming and Scripting

Simple Scripting Problem

Hi there, I was trying to add a line of text in the middle line of a file. I have counted the lines in the file, and then I divide it into 2, after that I am stuck on how am I suppose to append the line on that file? When I tried to use this command 'second line >> filename' it appends it at... (3 Replies)
Discussion started by: felixwhoals
3 Replies

8. UNIX for Dummies Questions & Answers

Ok simple question for simple knowledge...

Ok what is BSD exactly? I know its a type of open source but what is it exactly? (1 Reply)
Discussion started by: Corrail
1 Replies

9. Shell Programming and Scripting

simple scripting question

I am new to scropting and I am just trying to work on a few simple things.... Using sh I want to do something similar to the follwoing run a simple command like a dig then I want it to get the server that it is authorotative and return it to me saying somehting like xx.xx is authorotative. I am... (3 Replies)
Discussion started by: gennaro
3 Replies

10. Shell Programming and Scripting

Help with simple scripting actions

Hi, I am a beginner in unix shell scripting. I wanted simple information like 1- How to know what are the number of command line options given for the script file? 2- How to check if a variable value is interger or string? 3- How to use awk to replace value of a variable For example I... (5 Replies)
Discussion started by: Nads
5 Replies
Login or Register to Ask a Question