set -e julia --project --trace-compile=precompile.jl -q ./src/Example.jl >> /dev/null unset packageList; unset finalList; unset prepedColon; packageList=$(julia --project -E 'using Pkg; Pkg.status(mode=PKGMODE_PROJECT)' | sed 1,2d | head -n -1 | sed 's/.*\]\ //g' | sed 's/\ .*//g') prependColon=$(for p in $packageList; do echo ":"${p}", "; done) finalList="["${prependColon::-2}"]" julia --project -q -E "using Pkg; Pkg.add(url=\"https://github.com/JuliaLang/PackageCompiler.jl\", rev=\"v1.2.3\"); Pkg.instantiate(); Pkg.activate(); using PackageCompiler; create_sysimage(${finalList}; sysimage_path=\"generatedSysImage.so\", precompile_statements_file=\"precompile.jl\")" rm precompile.jl