bug-gnuastro
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tutorial PSF subtraction


From: Mohammad Akhlaghi
Subject: Re: Tutorial PSF subtraction
Date: Tue, 10 Jan 2023 18:32:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1

Thanks Alex,

Indeed, this different behavior is very peculiar/strange! This is a very basic operation and they should behave similarly.

Just to see if this is an OS issue or a shell issue, can you try running the 'bash' command so you enter Bash (assuming it is present in your OS), then try setting 'imgs' and printing its value?

After that test, open a new terminal so you enter your default shell.

About the next problem, your guess is right: indeed, the shell has given the full string (including the new line characters!) to Arithmetic as a single token! This is again very strange and I hadn't seen this occur before!

These new-line characters were put in 'imgs' by 'ls'. But this is again non-standard! 'ls' usually prints all the names on a single line. For example on my computer (assuming I have two files called 'junk1.txt' and 'junk2.txt'), I see this:

imgs=$(ls *.txt)
echo $imgs
junk1.txt junk2.txt

'ls' has an option '-1' (number one) for printing each file on a separate line. You can see the effect here:

imgs=$(ls -1 *.txt)
echo $imgs
junk1.txt
junk2.txt

Probably your 'ls' an alias to a customized 'ls' command that includes the '-1' option! You can check with this command:

alias | grep ls

If this is indeed the case, you can remove the alias for 'ls' with this command:

unalias ls

Then try setting 'imgs' and inspecting its value (to have all the files in one line).

If this is not the case, then things get more complicated, but I'll wait until you reply ;-).

Cheers,
Mohammad



reply via email to

[Prev in Thread] Current Thread [Next in Thread]