Without the use of '&&', '||' and ';' - Can you write a 2-line Linux script that lists all files (even ones hidden) in the current directory and the parent of the working directory and the /boot directory (in this order), in long format?
Asked
Active
Viewed 75 times
-2
-
Related: https://askubuntu.com/q/1446565 – Raffa Mar 07 '23 at 12:00
1 Answers
1
With full path as required:
find . .. /boot -type f -maxdepth 1 -exec readlink -f {} +
or of instead you need the output of ls -l:
ls -la . .. /boot
Gilles Quénot
- 3,569
- 1
- 15
- 14
-
This output doesn't make any sense, as it prefixes the current path in front of everything - and where to you see the requirement for full path? – Artur Meinild Mar 07 '23 at 09:22
-
You didn't answer from where you got the requirement for full path. – Artur Meinild Mar 07 '23 at 09:25
-
OP said `in long format` Maybe not well asked, but I guess it's full path – Gilles Quénot Mar 07 '23 at 09:26
-
And I guess it's "long format" as stated in `man ls` with the `-l` switch. And now your output is recursive, listing all files in subdirectories, which wasn't asked for as well.. I'm just giving up, have fun! – Artur Meinild Mar 07 '23 at 09:27
-
-
-
-
Thought about using "ls -aln && ls -aln .. && ls -aln /boot" but again for my purposes I can't use '&&', '||' or ';'. – Paballo Mogane Mar 07 '23 at 09:50
-
-
basically I need a command that'll give the result of what the above (my above comment) command would've had I been able to just write that. – Paballo Mogane Mar 07 '23 at 09:52
-
Yes I tried your command but unfortunately didn't return what I needed it to. – Paballo Mogane Mar 07 '23 at 10:10
-
Your response is quite vague. Thanks to elaborate/paste on https://www.toptal.com/developers/hastebin – Gilles Quénot Mar 07 '23 at 11:03