So I have found a file literally called "-X" in a folder, that is preventing me from using any meaningful commands in that folder because, as I understand it, at command runtime it will convert any wildcard characters into matching filenames, thus a command such as:
Ends up actually doing:
Because the -X file is the first one in the folder...which is not a valid argument for ls. And thats what SunOS tells me. This happens with every command I've tried so far. The nature of this problem has also made it difficult for me to google for answers, so I'm hoping someone here can help me with an explanation or a way to rename this file! Here's some examples of my troubles:
I've never encountered this before. Something tells me that there is something special about this -X "file"... besides it being a royal PITA.
sweet, that did the trick. Although I still had issues viewing the file because of the - inside the name, so I just renamed it again to new.dat using your syntax above, and now tail doesn't complain.
In general, when dealing with arguments which look like options, you can use a double dash to signal the end of options:
In that case, -o1 and -o2 are two option-arguments to command. -- signals the end of options. Since -X appears after --, it is not considered an option-argument even though it begins with a dash.
One way to create that file and then remove it:
Regards,
Alister
alister makes a good point - many utilities do have such an option. Not all do, though, which is why I suggested the course I did - it's fairly portable.
This subject is a common one, though. I've even heard of people doing this on purpose to act as a safety mechanism, although I wouldn't ever do so myself:
The "*" is expanded by my shell as "-i file1 file2 file3 file4 file5", so rm takes the -i as an option to prompt interactively just in case you do something silly like "rm *". It's bad practice, in my mind anyway, to rely on such, but to each their own.
Check your manpages to see if your utilities accept "--" to stop processing arguments. If so, it's a good habit to get in using, especially when scripting.
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Linux Gurus,
I need to provide Read only access for particular group of users, they should have Read only access to entire server except their Home directory.
I tried using setfacl that's not helping. Can you please suggest is there any other alternate way to address this request.
Your help is... (5 Replies)
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address
and column 3 contains “cc” e-mail address to include with same email.
Sample input file, email.txt
Below is an sample code where... (2 Replies)
logs:
"/home/abc/public_html/index.php"
"/home/abc/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
how to use "cut" or "awk" or "sed" to get the following result:
abc
abc
xyz
xyz
xyz (8 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hi all,
So I have found a file literally called "-X" in a folder, that is preventing me from using any meaningful commands in that folder because, as I understand it, at command runtime it will convert any wildcard characters into matching filenames, thus a command such as:
ls *Ends up... (1 Reply)
I need to remove a directory called "--"". But it seems "--" linked to /export/home/usr1, which I do not want to delete. How to rm "--" safely?
The OS is Solaris 9.
Thanks. (6 Replies)
Hi,
I was trying to call "script <an ip add>" command from .profile file to log everything whenever anyone logs in to this user. I did the following at the end of .profile. 1) Extracted the IP address who logged in 2) Called script < ip add> . The problem I am facing is all, aliases etc. written... (3 Replies)
Hi,
I issue smbclient on a Linux REd hat server :
smbclient -L ***.16.0.42 -U domaine/Administrator
Password:
Domain= OS= Server=
Domain= OS= Server=
Sharename Type Comment
--------- ---- -------
IPC$ IPC IPC distant
... (0 Replies)
Dear friends, following is the output of a script from which I want to remove spaces and new-line characters.
Example:-
Line1 abcdefghijklmnopqrstuvwxyz
Line2 mnopqrstuvwxyzabcdefghijkl
Line3 opqrstuvwxyzabcdefdefg
Here in above example, at every starting line there is a “tab” &... (4 Replies)