I´ve created the following script:
#!/bin/bash
isql -U databasename_dba -P password -b <<EOF!
select quantity, date from name_table where numer_id="1234"
go
quit
EOF!
Running the script I got the desirable output, see:
user@system$ ./EXECUTE_DAILY_4:
But now, how can I save this result that I see in my terminal window in a file? (.csv for example)
I adapted the following to my Sybase query:
#!/bin/bash
cat > test.sql <<EOF!
isql -U databasename_dba -P password -b
select quantity, date from name_table where numer_id="1234"
go
quit
EOF!
isql test.sql >result.csv
Without success, the above is not working.
Thanks in advance
You could effectively do the same thing but within the script itself. Something like:
#!/bin/bash
command=$(
isql -U databasename_dba -P password -b <<EOF!
select quantity, date from name_table where numer_id="1234"
go
EOF!
)
echo "$command" >> FILE.csv