I have about 200 C files that I need to format to a text file like so:
sem_post_stress.c
dup_fdopendir.c
shm_open.c and 198 others...
after making the files, the binaries are stored in ./aarch64/le/
along with .o
and .dep
.
I need to create a text file used at startup to make my image with the ~200 binaries, formatted like so, one line per binary:
/tmp/sem_post_stress = /home/.../.../.../.../aarch64/le/sem_post_stress
/tmp/dup_fdopendir = /home/.../.../.../.../aarch64/le/dup_fdopendir
/tmp/shm_open = /home/.../.../.../.../aarch64/le/shm_open
From this link: https://www.redhat.com/sysadmin/bash-scripting-loops
I know how to rename all files like: for i in $(ls *.); do
but not how to add a prefix for my qemu environment "/tmp/"
or the rest, =
and absolute path
.
I'm new to bash and never use it so I apologize if this is trivial, I have looked everywhere. Any hints or code is greatly appreciated!
/tmp/some
=/home/..../aarch64/le/some
), don't you? Or do you want to rename the files too?ls
is a terrible idea. With Bash, consider:shopt -s nullglob; for f in *; do <something>; done
. Look here to learn why.