Getting Error when the filename contains Space - xcode

I am having a filename with space. My Filename is (7 Bridges.app.dSYM)
I am printing the location of the file.
echo $dsymlocation
/Users/aa/Library/Developer/Xcode/DerivedData/bridges2-ekucwkrbbusrvsdxyegvpkdkiitj/Build/Products/Release-iphonesimulator/7\ Bridges.app.dSYM
If i give the location of the file directly as input to the below command, it is working.
dwarfdump --debug-pubnames /Users/aa/Library/Developer/Xcode/DerivedData/bridges2-ekucwkrbbusrvsdxyegvpkdkiitj/Build/Products/Release-iphonesimulator/7\ Bridges.app.dSYM
But if i give the variable name containing the file location, it is not working
dwarfdump --debug-pubnames "$dsymlocation"
It is showing the error as
unable to open '/Users/aa/Library/Developer/Xcode/DerivedData/bridges2-ekucwkrbbusrvsdxyegvpkdkiitj/Build/Products/Release-iphonesimulator/7\ Bridges.app.dSYM': No such file or directory
Can anyone help to resolve this error?

The error message complains about a file named 7\ Bridges.app.dSYM, while the file is, according to what you say, 7 Bridges.app.dSYM. It looks like the content of the variable dsymlocation contains a backslash. We can see the backslash also, when you do the echo $dsymlocation.

Related

Search the File Pattern from File Name

I have a file Patter_File.txt which stores lines like below -
ABC|ABC_[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].dat|8|,|70|NAME
ABC|ABC_[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].dat|9|,|70|PLACE
XYZ|XYZ_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].dat|23|,|70|SSN
XYZ|XYZ_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].dat|33|,|70|DOB
MNO|MNO_SUMMIT.dat|40|,|70|ADDRESS
MNO|MNO_SUMMIT.dat|5|,|70|COUNTRY
So this PATTERN_FILE.txt stores some information of the actual file but file name is stored in the pattern(if file name has date in the name) except the actual name.
My requirement is a command in which I should pass the actual file name like "ABC_20200408.dat" and it should return all the related lines from this file. Can someone please help.
below command is working fine but in this case I have to pass each pattern one by one to check which one is working.
echo "ABC_20200408.dat"|grep ABC_[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].dat

File locations in shell script property files

I have a property looks like below in property file and the properties are ready by "sourcing" in shell script.
MW_INSTALLER_11.6="/ade_autofs/scratch/test/installer/wls_generic.jar"
During sourcing, observing the below error and the variable is not read.
Where all other properties are read perfectly fine.
./upgrade.properties: line 45: MW_INSTALLER_11.6=/ade_autofs/scratch/test/installer/wls_generic.jar: No such file or directory
The file mentioned above is present specified path. Observing same issue with or without double quotes.
What is the right way to add the file location in property file?
Code around above specified property in property files
POST_UPGRADE_ANT_OPTIONS=
MW_INSTALLER_11.6="/ade_autofs/scratch/test/installer/wls_generic.jar"
NO_OF_RELEASES_TO_UPGRADE=1
Code around sourcing property file in shell script, here $1 represents property file
echo "Reading properties file $1" | tee -a $LOG_DRIVER_FILE
. ./$1
UPGRADE_PROPERTIES_FILE=$1
thanks In Advance, soman
I found the issue. Issue is due to the variable name contains "." [dot]
after changing from MW_INSTALLER_11.6="/ade_autofs/scratch/test/installer/wls_generic.jar"
to
MW_INSTALLER_11_6="/ade_autofs/scratch/test/installer/wls_generic.jar"
It worked fine.
Regards.

Error "The syntax of the command is incorrect" when renaming a file

I get this error on this step of my SQL 2005 process:
rename "G:\AuthorsList\AuthorsList_New.mdb""G:\AuthorsList\AuthorsListCopy.mdb"
I am trying to rename the file. I have also tried this and get the same error:
rename "G:\AuthorsList\AuthorsList_New.mdb" "G:\AuthorsList\AuthorsListCopy.mdb"
How do I resolve this error?
Check the documentation for the rename command:
Syntax
rename [Drive:][Path]filename1 filename2
Parameters
[Drive:][Path]filename1: Specifies the location and name of the file or set of files you want to rename. FileName1 can include wildcard characters (* and ?).
filename2: Specifies the new name for the file. You can use wildcard characters to specify new names for multiple files.
The second parameter cannot be a path, it should contain only the new filename:
rename "G:\AuthorsList\AuthorsList_New.mdb" AuthorsListCopy.mdb

Having Issue with file name appended with date -shell scripting

I tried to append the current day and time to the existing file name in shell scripting and I found my command is not working as expected.
For example, if my file name is f1.log and I nees to append it along with current time. This appended version must be used for further processing of the file.
I tried with the following script but getting an error
now=$(date +"%m-%d-%Y/%T")
echo hi >>time.log
mv "time.log" "time.$now.log" (error here : file or directory not found)
echo hello >> time.log$now (have to continue processing with new file)
You cannot have a / character in a filename. The mv command is looking for a directory named with the minute, day, and year of the output of date and trying to create a file named by the time. Just change your format to not include / in the filename.
The problem is with shell's interpertation of / in your date +"%m-%d-%Y/%T".
Change it to a - instead (or something else, as long as it's not / or another meta character that will make the files difficult to work with in the future)

MSDOS - "The system could not find the file specified"

I am trying to copy the contents of a log file to another log file using this command:
type \\server\f$\Test path\Test.log >> \\server2\f$\Logs\Testpath\Test.log
This has always worked in the path, but recently I have changed the location (path) to Test.log. The path is slightly longer. I now get an error:
The system could not find the file specified
I have googled this statement and the common responses are: 1) check the filename exists, 2) check the filename is not corrupt 3) Check the server is online.
I have done all of this. Is there a restriction on the number of characters a path can have? If there is then is there a workaround?
UPDATE 12/07/2012 09:49 GMT
Adding quotes around the path seems to resolve the problem. Why does adding quotes resolve the problem?
The problem was that the source path had a space in it. Adding quotes around the path resolved the problem.
Type is to examine a file, not to copy.
Also, if server is an actual server and not a folder, then you should be using two slashes (\server\share)
Example:
copy \\server\f$\Sourcepath\Test.log \\server2\f$\Logs\Destpath\Test.log /y
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true

Resources