LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to fix command not found error and what is too many argument error. (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-fix-command-not-found-error-and-what-is-too-many-argument-error-923571/)

deepakunix 01-13-2012 05:44 AM

How to fix command not found error and what is too many argument error.
 
friends,
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
Deepak

deep27ak 01-13-2012 05: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 07:46 AM

And what command do you use to run your scripts?

deepakunix 01-13-2012 09:10 AM

Hi,deep27ak,
Yhank u for ur quick response.These are my codes of 2 general files.
I am using linux 2.6
File=1 for writecentre
-------
#!/bin/bash
if [ $# -ne 3 ]
then
echo improper arguments
exit
fi

str=$1
row=$2
attr=$3

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";;
esac
echo -n "\033[0m"

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

str="$1"
row=$2
col=$3
attr=$4
tput cup $row $col

case $attr in
[bB])echo -n "\033[1m$str";;
[nN])echo -n "$str";;
[rR])echo -n "\033[7m$str";;
esac
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 .


MASTER=$HOME/emaster.dbf
TRAN=$HOME/etran.dbf
...............
............
...............
while true
do
clear
writecenter"payroll processing system" 7 "B"
writec"your choice?" 15 30 "N"
...............
...........
.........
esac
done

Thak U
Deepak

deep27ak 01-13-2012 09: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 09: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

PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

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-14-2012 12:30 AM

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
Deepak


All times are GMT -5. The time now is 07:43 PM.