On Wed, Jul 01, 2009 at 09:52:00AM +0100, Adam D. Barratt wrote:
> Ryan Niebur wrote, Wednesday, July 01, 2009 8:21 AM:
>> bash jade test-checkbashism $ cat script.sh
>> #!/bin/sh
>>
>> source a
> [...]
>> bash jade test-checkbashism $ checkbashisms ./script.sh
>> bash jade test-checkbashism $ echo $?
>> 0
>
> It *does*, but not if the filename being sourced is a single character.
>

ok. but that's not the only case where it doesn't detect it. the
problem that caused me to make this small test case and file the bug
was like this:

bash jade master ORDB-DebianModules-Generator $ cat test
#!/bin/sh

if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi
bash jade master ORDB-DebianModules-Generator $ checkbashisms test
bash jade master ORDB-DebianModules-Generator $ bash test
bash jade master ORDB-DebianModules-Generator $ dash test
test: 5: source: not found
bash jade master ORDB-DebianModules-Generator $ 

yes, this seems silly since of course sourcing .bashrc in a /bin/sh
script isn't gonna work, but my script is really #!/bin/bash and I'm
using source so that if I ever try to change the shebang from bash to sh,
I will run checkbashisms, it will draw my attention to this line, and
I will remember that I can't change it. at least that was my intention..

-- 
_________________________
Ryan Niebur
[email protected]

Attachment: signature.asc
Description: Digital signature

Reply via email to