'Can't use temp dir
I'm trying to make tmp dir with bash script using that command:
mktemp -d /tmp/foo.XXXXXXXXX\r
So, as an result a have, for example (with common in the end):
/tmp/foo.wGBkCRpYt.
But I can't change dir after that from this bash script:
cd /tmp/foo.wGBkCRpYt
Answer: No such file or directory
cd /tmp/foo.wGBkCRpYt.
Answer: No such file or directory
What's wrong I do?
Solution 1:[1]
The first line of your example ends with r, while the rest of your examples end with . (dot, period, full stop). Perhaps if they all matched, it would work.
Tested on Debian 11:
This works for me:
$ mktemp -d /tmp/foo.XXXXXXXXX\r
/tmp/foo.HaOsouwEHr
$ cd /tmp/foo.HaOsouwEHr
$ pwd
/tmp/foo.HaOsouwEHr
$
This works for me:
$ mktemp -d /tmp/foo.XXXXXXXXX.
/tmp/foo.H8ERdkgtV.
$ cd /tmp/foo.H8ERdkgtV.
$ pwd
/tmp/foo.H8ERdkgtV.
$
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ben Scott |
