I am customizing my Bash prompt by adding more information, which contains a glance to the list of current directory.
I already understand that changing variable PS1
would help me with everything. Even more, this variable allows me to execute commands each time.
I've tried to use ls --color=always
to get a list of files in the current directory. The implementation is below:
PS1='... $(ls -F --color=always | xargs | cut -d " " -f -20)\n ...'
The shell gets me up to 20 file names in the current directory each time. However, it never tells me if there are more files. What do I need to do? I expect it to tell me with the ellipsis ('...') or something else.
PS: 'ls' seems to behave differently according to the output environment (e.g. tty and file). What if I want a formatted output in the prompt (with more lines)?