dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit e7974952012edfa394fa692cc9213ebfe9d0d2c8
parent 7925dd5929d8ec4bf57c13ea20678df96ce55e0a
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Mon, 15 Apr 2019 13:23:49 +0200

Fix shellcheck warnings in crun

Diffstat:
M.config/newsboat/urls | 1+
Mbin/crun | 18+++++++++---------
2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/.config/newsboat/urls b/.config/newsboat/urls @@ -4,6 +4,7 @@ http://www.smbc-comics.com/rss.php comedy "~comedy: Saturday Morning Breakfast C http://www.threewordphrase.com/rss.xml comedy "~comedy: Three Word Phrase" https://xkcd.com/rss.xml comedy "~comedy: xkcd" https://what-if.xkcd.com/feed.atom comedy "~comedy: xkcd: what if" +https://www.theonion.com/rss comedy news "~comedy: The Onion" http://www.dr.dk/nyheder/service/feeds/allenyheder news "~news: DR Nyheder" http://www.democracynow.org/democracynow.rss news "~news: Democracy Now!" diff --git a/bin/crun b/bin/crun @@ -1,15 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash # CRUN compiles C/C++ code to a temporary file, and executes it. # Author: Anders Damsgaard, andersd@risup.net # License: GNU Public License, v. 3+ # Define compilers and the common compiler flags -CC=gcc -CXX=g++ +CC=cc +CXX=cpp CFLAGS="-g -Wall -Wextra " -fullfilename=$(basename $1) +fullfilename=$(basename "$1") extension="${fullfilename##*.}" filename="${fullfilename%.*}" tmpname=/tmp/$filename @@ -18,22 +18,22 @@ tmpname=/tmp/$filename # and recompile it if that's the case. # arg 1: compiler, arg 2: source code file function compile { - if [ -e $tmpname ]; then + if [ -e "$tmpname" ]; then if [[ $2 -nt $tmpname ]]; then - $1 $2 -o $tmpname $CFLAGS $3 $4 $5 $6 $7 $8 $9 + $1 "$2" -o "$tmpname" "$CFLAGS" "$3" "$4" "$5" "$6" "$7" "$8" "$9" fi else - $1 $2 -o $tmpname $CFLAGS $3 $4 $5 $6 $7 $8 $9 + $1 "$2" -o "$tmpname" "$CFLAGS" "$3" "$4" "$5" "$6" "$7" "$8" "$9" fi } # Compile source to file in /tmp if [ "$extension" == "c" ]; then - compile $CC $1 $2 $3 $4 $5 $6 $7 $8 $9 + compile $CC "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" fi if [ "$extension" == "cpp" ]; then - compile $CXX $1 $2 $3 $4 $5 $6 $7 $8 $9 + compile $CXX "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" fi $tmpname