LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-22-2007, 05:03 AM   #1
zeeshan673
LQ Newbie
 
Registered: Feb 2007
Posts: 2

Rep: Reputation: 0
-bash: /bin/: Argument list too long


Hello folks,

I was having a problem setting the path environments so I modified .bashrc and .bash_profile where I wrote the following lines:

export PATH=$PATH: /home/zahmed/Marvell/simulators/

In fact, in the above specified directory (../simulators), there is a software installed called cver and I wanted to set the path for it so that I don't have to give the path for it in all of my scripts. Similarly I set the path for three other simulators and then logged out and when I am logged back in, it is giving me the following errors:

[zahmed@hafez ~]$ ls
-bash: /bin/ls: Argument list too long

[zahmed@hafez ~]$ vi .bashrc
-bash: /usr/bin/vim: Argument list too long

when I wrote "echo $PATH", it gave me a big list. Seems like for everything, it is giving me an argument list too long error.

Is there any suggestion how to fix it. I will really appreciate it.

My email address is zeeshan673@gmail.com

Warmest regards,
Zeeshan
 
Old 02-22-2007, 05:30 AM   #2
Daws
Member
 
Registered: May 2006
Location: UK
Distribution: Debian
Posts: 447

Rep: Reputation: 39
Quote:
export PATH=$PATH: /home/zahmed/Marvell/simulators/
Probably a typo, but there shouldn't be a space between : and /home.

Slightly more useful is this from the coreutils faq.
 
Old 02-22-2007, 05:55 AM   #3
zeeshan673
LQ Newbie
 
Registered: Feb 2007
Posts: 2

Original Poster
Rep: Reputation: 0
how to fix it back to whatever it was.

The problem is when I am trying to modify the .bash_profile or .bashrc files, it is not opening the vim or any text editor so that I can fix it.

[zahmed@hafez ~]$ vi .bashrc
-bash: /usr/bin/vim: Argument list too long

[zahmed@hafez ~]$ vi .bash_profile
-bash: /usr/bin/vim: Argument list too long

So the main problem is: How to fix it back so that it will be able to work again.

Thanks for your time.

Warmest regards,
Zeeshan
 
Old 02-22-2007, 06:45 AM   #4
Daws
Member
 
Registered: May 2006
Location: UK
Distribution: Debian
Posts: 447

Rep: Reputation: 39
Ah. That could be a problem. Can you login as root or use su?

If you can try something like this as root:

Code:
exec /bin/env -i HOME=/root TERM=$TERM PS1=$PS1 PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash
This should clear the environment of the offending PATH variable temporarily, just to correct the files.

Obviously there is a chance you will get a similar argument list too long error. In that case you will want to find a live cd and use it to edit the files.
 
Old 02-22-2007, 10:25 AM   #5
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Why not simply use
Code:
unset PATH
or reset $PATH to a more sane value:
Code:
PATH=/usr:/usr/bin:/bin
The issue with $PATH can also be avoided by simply using specifying the necessary paths.
So:
Code:
#Don't do this, as the shell will consult $PATH to find "vi" program.
#vi .bashrc
#Instead, do:
/bin/vi ./.bashrc
#of course, you can also use another editor, like vim (usually in /usr/bin/)

Last edited by timmeke; 02-22-2007 at 10:26 AM.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Zip gives error "-bash: /usr/bin/zip: Argument list too long" konathamsrinu Programming 3 07-06-2006 10:08 AM
bash: /bin/ls: Argument list too long. Workaround? Kropotkin Linux - General 3 02-28-2006 11:45 AM
bash: /bin/rm: Argument list too long? FiveFlat Linux - General 5 08-11-2004 11:29 PM
-bash: /bin/mv: Argument list too long balanagireddy Linux - General 2 07-27-2004 11:19 PM
/bin/rm: Argument list too long dragon49 Linux - Software 1 09-02-2003 12:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:41 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration