All Questions
6
questions
3
votes
1
answer
404
views
Why is "${1-"$var"}" (option 6 down below) not mentioned in POSIX?
The only reference I could find in the spec is this:
It would be desirable to include the statement "The characters from an enclosed "${" to the matching '}' shall not be affected by ...
1
vote
1
answer
287
views
UNIX KSH - Using double quotes or no quotes when assigning strings with wildcard to a variable?
I am new to UNIX and currently working on a shell script where I will be receiving files with names such as abc_123_date.zip so the file names will be abc_123_12312005. Instead of hardcoding abc_123_*....
1
vote
1
answer
1k
views
How to escape a range of wildcards in unix shell script?
I need to execute the following Oracle SQL in unix crontab. The query is as follows:
select count(*)
from tbaadm.htd
where cust_id is not null and
pstd_flg = 'Y' and
del_flg = 'N' and
tran_date = (...
1
vote
1
answer
70
views
Problematic quotations
#!/bin/ksh
typeset FILE_SIZE1=$(stat -f '%z' test.txt);
typeset -r BK_STATARGS="-f '%z'"
typeset FILE_SIZE2=$(stat ${BK_STATARGS} test.txt);
echo without arg var ${FILE_SIZE1}
echo with arg var... ${...
2
votes
2
answers
137
views
Awk not rendering any result
My goal is to get the file created in the current month in a directory.
It seems that the command is correct but not rendering any result:
Date=`date '+%b'`
echo $Date
Oct
ls -l | awk -v d="$Date" ...
22
votes
2
answers
1k
views
Why escape trivial characters in shell script?
I just opened a legacy shell script (written in old ksh88 on Solaris) and found the following repeated all throughout the code:
[ -f $myfile ] && \rm -f $myfile
The escaping backslash ...