문제

I'm at a Hackathon right now so if someone would answer this soon, you'd be doing me a huge favor.

I've written a function called ls() in my .profile that looks like this:

ls() {

  if(some condition);
    do something
  else
    ls; #(CALL TO ORIGINAL ls SYSTEM CALL)
  fi

}

But here when it goes to the else part, it just enters an infinite loop

How can I call the original ls system call in else Or, how can I make ls behave differently in one folder and normally in the others.

도움이 되었습니까?

해결책

Use the full path to the executable:

/bin/ls

다른 팁

The command built-in performs command lookup without considering functions:

ls() {

  if(some condition);
    do something
  else
    command ls
  fi

}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top