-   Linux - Newbie (
-   -   How to fix command not found error and what is too many argument error. (

deepakunix 01-13-2012 04:44 AM

How to fix command not found error and what is too many argument error.
i am a begginner to shell script.i myself do a project in shell script.And obviously facing some problem.

first, i develop 2 general files and then other files are developed.2 general files are used in all my other files.But when i run these other files i found command not found error comes.i have gone through ur forum.But i did not get any proper solutions.Not only that,i also got too many argument error.If needed i can also send my code.

Thank U

deep27ak 01-13-2012 04:51 AM

how about you post your script here so that members can help you further? :)

kindly use code tags while posting your script

MTK358 01-13-2012 06:46 AM

And what command do you use to run your scripts?

deepakunix 01-13-2012 08:10 AM

Yhank u for ur quick response.These are my codes of 2 general files.
I am using linux 2.6
File=1 for writecentre
if [ $# -ne 3 ]
echo improper arguments


length='echo $str | wc -c'
col='expr \(80 - $length \)/2'
tput cup $row $col

case $attr in
[bB])echo -n "\033[1m$str";;
[nN])echo -n $str;;
[rR])echo -n "\033[7m$str";;
echo -n "\033[0m"

File 2 for writec
if [ $# -ne 4 ]
echo improper arguments

tput cup $row $col

case $attr in
[bB])echo -n "\033[1m$str";;
[nN])echo -n "$str";;
[rR])echo -n "\033[7m$str";;
echo -n "\033[0m"

And these two files are used for writecentre and writec commands that i use in all my other files.
When i run these two files in bash shell ,i get o/p as improper arguments.
ok,after that when i use these 2 files in my other program ,it gives writecenter & writec command are not found.

And these r the codes where i use my 2 files .

while true
writecenter"payroll processing system" 7 "B"
writec"your choice?" 15 30 "N"

Thak U

deep27ak 01-13-2012 08:17 AM

Hey ,

my office time is over was just about to leave and will be back on Monday.

Really sorry but I am sure here someone else will help you out

Best of Luck

J.A.X 01-13-2012 08:46 AM

I did not understand what's your problem well, but I think adding your '2 gerneral scripts' to your PATH Environment variable can fix this problem ...

or you can point to them with thier full path.

suppose that your '2 gerneral scripts' are located at /home/foo/bin

you can add them to the environment variable by editing the bash_profile file in /home/foo/bash_profiles

edit the $PATH by adding the directory /home/foo/bin

your $PATH may not look like this ... so don't edit anything yet


just add at the end of the line :/home/foo/bin

so it becomes PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:/home/foo/bin

then save the file and reload it

$# source /home/foo/.bash_profile

If I understood your problem right that may help.
Or you can point to your '2 gerneral scripts' with thier full path in the 'other files are developed'.

I hope that help in somehow

Kind Regards

deepakunix 01-13-2012 11:30 PM

Hi J.A.X,
Thak u for ur response.

I will try all the things to set my enviormenatal variable.But i can not find any solution.
1)First i try to the path in last to my general script,but the result is same.
2)Then i came to command prmpt to give the path as echo $path,but no result
3)Then i give the path in my general script in first line,then it gives the error that path is not a command.
4)Then,i give the path in my files ,but no result.

Overall,my problem is i donot know how to set the path.
so,please give me an example ,so that i can understand how to set the environmental variable.

Thank U

All times are GMT -5. The time now is 11:20 AM.