In what way is it not working? Show exactly what you do and exactly what happens. Word for word, keystroke for keystroke. Don't paraphrase anything when you don't know what's relevant or not.
Understand that once expansion of the wildcard has happened it can't be taken back. The shell itself expands the wildcard before it passes what it has expanded the wildcard to to the respective program.
Here is an example: suppose you call the program "ls". You enter on the commandline
first, the shell notices the wildcard and replaces it with all the filenames in the directory. Let us suppose there are three files, "file.a", "file.b" and "file.c". The shell replaces the asterisk for these names, arriving at:
This is what "ls" will be presented, because all the expanding is done before "ls" is even called.
So far, so good. Now suppose you do:
You have protected the argument inside the function, but because you didn't protect the wildcard when calling the function "subfunc()" will only be presented the result of its expansion. You will need:
Also notice, that shell interpretation "eats away" protection:
The asterisk inside the variable declaration seems to be protected, but by expanding the line "$var" the shell removes the quotation and when the line is executed it is interpreted a second time. Both the following modifications would work, both times it boils down to doubly double-quote, so to say:
I am running the ETL job to passing the database username,pssswd positional arguments to shell script (bash) and how can we suppress/hide the password from ps command. (2 Replies)
I have the below two commands in my script.
tar -xf hello.tar
unzip -o tempp.zip
When i run the script i see the below on my standard out.
How can i suppress output coming from both the tar and unzip on my standard output. (3 Replies)
Hi,
I was looking for a simple code to suppress the text between 2 characters. the characters can be of same kind like "*" or "(" and ")". The number of characters are not consistent and could vary.
How can I suppress the text between 2 characters?
Example:
Input : Hello (Within Bracket)... (8 Replies)
Hi,
I am trying to run a script using awk and sed a few times.
The script itself seems to work fine but in a final awk statement it throws up a warning:
awk: warning: escape sequence `\.' treated as plain `.'
script:
... (3 Replies)
Hi
I have a script which connects to oracle using sqlplus
if ! check_sqlplus "$ORACLE_SID" ; then
echo "Unable to use sqlplus for sid $ORACLE_SID"
return 1
else
echo "attempting to connect to database"
echo $ORACLE_HOME
echo $ORACLE_SID
echo "Status before entering... (2 Replies)
Hi
I am working in ksh and getting the trace after trying to remove the file which in some cases does not exist:
$ my_script
loadfirm.dta.master: No such file or directory
The code inside the script which produces this trace is the following:
] || rm ${FILE}.master >> /dev/null
for... (3 Replies)
Hi All
this is a simple script
#! /bin/bash
FileCnt=`ls -lrt $DIR/* | wc -l`
echo $FileCnt
how could i escape the error msg if there are no files in $DIR
ls: /home/sayantan/test/files/cnt/*: No such file or directory
0
Looking forward for a quick reply
Regards, Newbie (2 Replies)
I am using this command
find . -type f -mmin "+$t" > holder
Unfortunatley that is also printing files that begin with a period. Such as .bash_history.
What can I do to supress files that begin with a period? (1 Reply)
Hi,
One of our application is producing log files. But if we open the log file in vi or less or view mode, it shows all the special characters in it. The 'cat' shows correctly but it shows only last page. If I do 'cat' <file_name> | more, then again it shows special characters.
... (1 Reply)
I need to suppress the output to the screen. I am appending to a file so do not need the output on the screen in the CLI environment.
eg.
cat $HOME/somefile >> $HOME/anotherfile
I am doing this a number of times with SQL output files so I can look at the finished file not on the screen in the... (3 Replies)