I'm trying to use external cd (/usr/bin/cd) to jump to parent directory /usr/bin/cd .. but it doesn't work (no error message, current directory remains as was). I know this is a builtin bash command and this whole operation is pointless but it's part of school assignment, any ideas how to achieve it?
Asked
Active
Viewed 103 times
0
Paulo Tomé
- 3,754
- 6
- 26
- 38
Janek
- 1
-
https://unix.stackexchange.com/a/50025/108618 – Kamil Maciorowski Mar 24 '20 at 00:49
-
1I believe all the viable uses of external `cd` are listed in the answers to this question: [What is the point of the `cd` external command?](https://unix.stackexchange.com/q/50058/73093). They are *extremely* specific. – Michael Homer Mar 24 '20 at 01:57
-
Is the point of the exercise to see how many students have read all of the way through the description of the `cd` utility in the _Single UNIX Specification_ and are prepared to come back and challenge the premise of the exercise, doco in hand? (-: – JdeBP Mar 24 '20 at 08:38
1 Answers
-2
I found the answer myself. Proper usage is:
. /usr/bin/cd ..
Janek
- 1
-
2that only works if `/usr/bin/cd` is implemented as a shell script. It doesn't _have_ to be, though that would be a trivial implementation. – ilkkachu Mar 30 '20 at 20:49