Sample Header Ad - 728x90

chmod +x not working as expected, running another tool instead

2 votes
1 answer
886 views
Just wrote a simple commandline tool which works fine with swift but doesn't run as executable after chmod +x ... This is happening on my system so might be configuration related but not sure how to resolve. --- #### Create Script: vi test.swift #### Enter content: import Foundation print("Hello, World!") Running normally swift test.swift gives Hello, World! as expected but when I make it executable & run it then it's failing. #### Make Executable: chmod +x test.swift ./test.swift #### Output: Version: ImageMagick 7.1.0-52 Q16-HDRI aarch64 20549 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI Modules OpenMP(5.0) Delegates (built-in): bzlib fontconfig freetype gslib heic jng jp2 jpeg lcms lqr ltdl lzma openexr png ps raw tiff webp xml zlib Compiler: gcc (4.2) Usage: import [options ...] [ file ] Image Settings: -adjoin join images into a single multi-image file By default, 'file' is written in the MIFF image format. To specify a particular image format, precede the filename with an image format name and a colon (i.e. ps:image) or specify the image type as the filename suffix (i.e. image.ps). Specify 'file' as '-' for standard input or output. import: delegate library support not built-in '' (X11) @ error/import.c/ImportImageCommand/1297. ./test.swift: line 3: syntax error near unexpected token `"Hello, World!"' ./test.swift: line 3: `print("Hello, World!")' Why is it running commandline tool imagemagick?
Asked by staticVoidMan (123 rep)
Nov 11, 2022, 02:12 PM
Last activity: Nov 11, 2022, 02:35 PM