/etc/rc: remove useless cat

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

/etc/rc: remove useless cat

Christian Weisgerber
Since /etc/rc uses ksh constructs anyway, we should use $(<file) instead
of $(cat file).

ok?

Index: rc
===================================================================
RCS file: /cvs/src/etc/rc,v
retrieving revision 1.540
diff -u -p -r1.540 rc
--- rc 6 Nov 2019 16:26:24 -0000 1.540
+++ rc 10 Nov 2019 13:48:36 -0000
@@ -220,7 +220,7 @@ reorder_libs() {
  $_install /usr/libexec/ld.so /usr/libexec/ld.so.save
  $_install ld.so.test $_lib_dir/ld.so
  else
- cc -shared -o $_lib $(ls *.so | sort -R) $(cat .ldadd)
+ cc -shared -o $_lib $(ls *.so | sort -R) $(<.ldadd)
  [[ -s $_lib ]] && file $_lib | fgrep -q 'shared object'
  LD_BIND_NOW=1 LD_LIBRARY_PATH=$_tmpdir awk 'BEGIN {exit 0}'
  LD_BIND_NOW=1 LD_LIBRARY_PATH=$_tmpdir openssl \
@@ -389,7 +389,7 @@ ttyflags -a
 
 # Set keyboard encoding.
 if [[ -x /sbin/kbd && -s /etc/kbdtype ]]; then
- kbd "$(cat /etc/kbdtype)"
+ kbd "$(</etc/kbdtype)"
 fi
 
 wsconsctl_conf
--
Christian "naddy" Weisgerber                          [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: /etc/rc: remove useless cat

Theo Buehler-3
On Sun, Nov 10, 2019 at 02:51:32PM +0100, Christian Weisgerber wrote:
> Since /etc/rc uses ksh constructs anyway, we should use $(<file) instead
> of $(cat file).
>
> ok?

ok

>
> Index: rc
> ===================================================================
> RCS file: /cvs/src/etc/rc,v
> retrieving revision 1.540
> diff -u -p -r1.540 rc
> --- rc 6 Nov 2019 16:26:24 -0000 1.540
> +++ rc 10 Nov 2019 13:48:36 -0000
> @@ -220,7 +220,7 @@ reorder_libs() {
>   $_install /usr/libexec/ld.so /usr/libexec/ld.so.save
>   $_install ld.so.test $_lib_dir/ld.so
>   else
> - cc -shared -o $_lib $(ls *.so | sort -R) $(cat .ldadd)
> + cc -shared -o $_lib $(ls *.so | sort -R) $(<.ldadd)
>   [[ -s $_lib ]] && file $_lib | fgrep -q 'shared object'
>   LD_BIND_NOW=1 LD_LIBRARY_PATH=$_tmpdir awk 'BEGIN {exit 0}'
>   LD_BIND_NOW=1 LD_LIBRARY_PATH=$_tmpdir openssl \
> @@ -389,7 +389,7 @@ ttyflags -a
>  
>  # Set keyboard encoding.
>  if [[ -x /sbin/kbd && -s /etc/kbdtype ]]; then
> - kbd "$(cat /etc/kbdtype)"
> + kbd "$(</etc/kbdtype)"
>  fi
>  
>  wsconsctl_conf
> --
> Christian "naddy" Weisgerber                          [hidden email]
>

Reply | Threaded
Open this post in threaded view
|

Re: /etc/rc: remove useless cat

Antoine Jacoutot-7
In reply to this post by Christian Weisgerber
On Sun, Nov 10, 2019 at 02:51:32PM +0100, Christian Weisgerber wrote:
> Since /etc/rc uses ksh constructs anyway, we should use $(<file) instead
> of $(cat file).
>
> ok?

OK aja

>
> Index: rc
> ===================================================================
> RCS file: /cvs/src/etc/rc,v
> retrieving revision 1.540
> diff -u -p -r1.540 rc
> --- rc 6 Nov 2019 16:26:24 -0000 1.540
> +++ rc 10 Nov 2019 13:48:36 -0000
> @@ -220,7 +220,7 @@ reorder_libs() {
>   $_install /usr/libexec/ld.so /usr/libexec/ld.so.save
>   $_install ld.so.test $_lib_dir/ld.so
>   else
> - cc -shared -o $_lib $(ls *.so | sort -R) $(cat .ldadd)
> + cc -shared -o $_lib $(ls *.so | sort -R) $(<.ldadd)
>   [[ -s $_lib ]] && file $_lib | fgrep -q 'shared object'
>   LD_BIND_NOW=1 LD_LIBRARY_PATH=$_tmpdir awk 'BEGIN {exit 0}'
>   LD_BIND_NOW=1 LD_LIBRARY_PATH=$_tmpdir openssl \
> @@ -389,7 +389,7 @@ ttyflags -a
>  
>  # Set keyboard encoding.
>  if [[ -x /sbin/kbd && -s /etc/kbdtype ]]; then
> - kbd "$(cat /etc/kbdtype)"
> + kbd "$(</etc/kbdtype)"
>  fi
>  
>  wsconsctl_conf
> --
> Christian "naddy" Weisgerber                          [hidden email]
>

--
Antoine