-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
awk argument issues #664
Comments
Hi Seth, could you paste a small example script where that happens and the output of pash with |
Sure, here's the script: and here's the output: PaSh: Arguments: Daemon: Reading variables from: /tmp/pash_lYG2xjY//pash_156062311225329 Daemon: Time part is: Time: Daemon: Process: 1 exited. Exec time was: None Daemon: Reading variables from: /tmp/pash_lYG2xjY//pash_15216515429467 Daemon: Time part is: Time: Daemon: Process: 2 exited. Exec time was: None Daemon: Reading variables from: /tmp/pash_lYG2xjY//pash_23751072121834 Daemon: Time part is: Time: Daemon: Process: 3 exited. Exec time was: None Daemon: Reading variables from: /tmp/pash_lYG2xjY//pash_45002642519855 Daemon: Time part is: Time: Daemon: Process: 4 exited. Exec time was: None Daemon: Reading variables from: /tmp/pash_lYG2xjY//pash_254241593418064 Daemon: Time part is: Time: Daemon: Process: 5 exited. Exec time was: None Daemon: Reading variables from: /tmp/pash_lYG2xjY//pash_81192990326443 Daemon: Time part is: Time: Daemon: Process: 6 exited. Exec time was: None at which point execution freezes. |
Could try to shrink this test (make it smaller) and make it to work without input files and also print here what bash returns when you run it? I can't reproduce the error. Also what branch of PaSh are you using? |
I did a little more toying around and came up with this simple example which works normally but not with PaSh. I made data.txt a few lines of data where some have their first field's value more than 5 characters and some don't. I found that with bash, it works as expected (only the lines for which the first field are more than 5 characters are written to output.txt). But with PaSh all lines of data.txt are written to output.txt. I'm only able to reproduce this error, however, when the awk command is run in a subshell (without the subshell this works fine). My best guess as to what's happening is that in the subshell, PaSh is interpreting $1 to be the first argument to the script (I found that giving this script an argument of any length changed the behavior of PaSh such that nothing was written to output.txt). I'm using the most up-to-date version of standard PaSh on the main branch. |
Thank you very much for this! I am really perplexed... it works for me. I paste the output of my PaSh below running on the main branch: $ git pull
Already up to date.
$ cat data.txt
123456
1234
123456
123456
123456
1234
1234
123456
$ ./pa.sh test.sh
$ cat output.txt
123456
123456
123456
123456
123456 |
I remember that we had the issue that you are describing in the past, but this example works for me... I am not sure why haha |
PaSh has been failing to run some scripts containing awk. I believe the issue is that PaSh is interpreting arguments to awk (ex: $1) as the first argument to the entire script, when it should be interpreting it as the first argument piped into awk (at least this is my interpretation as someone relatively new to shell scripting). I've
pash-awk-issue-files.zip
attached some scripts that run with bash, but have awk issues with PaSh.
The text was updated successfully, but these errors were encountered: