Why does the "cp" command not work with pasted directory path from "pwd | pbcopy" command?
0
votes
2
answers
523
views
I ran
pwd | pbcopy
command in Terminal on my MacBook Pro to copy the working directory to the clipboard. The working directory looks like this:
/Users/JohnSmith/PycharmProjects/100 Days of Code - The Complete Python Pro Bootcamp2/Day 2/Type Error, Checking and Conversion
But when I change to another completely different directory, type cp
followed by CMD+V to paste the first directory path I get this error message:
cp: Conversion is not a directory
However, when I edit the clipboard content to append a forward slash character "/", I do not get the error message above. But when I then append the name of the file that I want to copy like this;
/Users/StephenLearmonth/PycharmProjects/100 Days of Code - The Complete Python Pro Bootcamp2/Day 2/Type Error, Checking and Conversion/task.py task-2.py
I get this error message:
cp: task-2.py is not a directory
It only copies the file task.py
when I put double quotes around the directories in the copied directory path.
Is this a bug with Unix or the pwd | pbcopy
command?
Anyone else had this problem?
Asked by sjl26916091
(35 rep)
Nov 13, 2024, 02:21 PM
Last activity: Nov 14, 2024, 10:16 PM
Last activity: Nov 14, 2024, 10:16 PM