1

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.

4

2 回答 2

6

使用可执行文件的完整路径:

/bin/ls
于 2013-06-16T18:05:43.957 回答
3

command内置执行命令查找而不考虑功能:

ls() {

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

}
于 2013-06-16T18:58:46.857 回答