LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-13-2012, 04:44 AM   #1
deepakunix
LQ Newbie
 
Registered: Jan 2012
Posts: 3

Rep: Reputation: Disabled
Question 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
 
Old 01-13-2012, 04:51 AM   #2
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,188
Blog Entries: 4

Rep: Reputation: 220Reputation: 220Reputation: 220
how about you post your script here so that members can help you further?

kindly use code tags while posting your script
 
1 members found this post helpful.
Old 01-13-2012, 06:46 AM   #3
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
And what command do you use to run your scripts?
 
1 members found this post helpful.
Old 01-13-2012, 08:10 AM   #4
deepakunix
LQ Newbie
 
Registered: Jan 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Unhappy

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

Last edited by deepakunix; 01-13-2012 at 08:25 AM.
 
Old 01-13-2012, 08:17 AM   #5
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,188
Blog Entries: 4

Rep: Reputation: 220Reputation: 220Reputation: 220
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
 
1 members found this post helpful.
Old 01-13-2012, 08:46 AM   #6
J.A.X
Member
 
Registered: Jan 2010
Distribution: Fedora 19
Posts: 81

Rep: Reputation: 2
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
 
1 members found this post helpful.
Old 01-13-2012, 11:30 PM   #7
deepakunix
LQ Newbie
 
Registered: Jan 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bind(port 8090): Invalid argument error in ffserver patch found unkajim Linux - Software 1 01-01-2012 03:52 PM
Unable to compile C++ programs.make:g++ command not found error.Error 127 PrathuD Programming 3 03-16-2009 12:44 PM
cryptsetup error (Command failed: Invalid argument) SlackN00b Slackware 5 02-07-2007 12:59 PM
possible fix error imlib-config not found aus9 Linux - Newbie 2 08-14-2006 08:24 AM
Argument 2 - Pointer Error ?? Easy Fix?? Mistro116@yahoo.com Programming 1 10-04-2005 07:04 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration