06-05-2014 09:49 AM
I do plenty of upgrading and managing of the file systems on XR, and I can say this is not easy.
one example is I can do this and the regex works, so thanks:
install activate disk0 :*4.2.3* sync
but then we get here:
dir disk0:*4\.3\.2* shows all the files
but
delete disk0:*4\.3\.2
%Error deleting /disk0:/*4.3.2* : No such file(s)
Delete and rmdir do not respect regex syntax.
Furthermore, ksh is extremely limited.
rmdir *4\.3\.2* yields:
Directory not empty
"Oh that's fine, just add the -r tack right?"
# rmdir -rf *4\.3\.2*
rmdir: illegal option -- r
rmdir: illegal option -- f
What is the point of having unix utilities like this or even supporting regex if the commands do not support/respect it?
Perhaps I am doing something wrong or there is a better method. Please advise.
Solved! Go to Solution.
06-05-2014 02:24 PM
Hi Evan,
I hope that I am able to address all of your concerns below.
If not let me know.
The rmdir command does not support wildcards in XR or Linux. Instead in linux you have to use more creative ways using command chaining. The same could be done in XR but I don't see any use cases for that. As well QNX, which we use as our kernel, does not support the -r or -f switches.
Delete seems to work fine for me.
RP/0/RSP0/CPU0:ASR9001-A#delete harddisk:/FPGA*
Thu Jun 5 17:15:14.590 EST
Delete harddisk:/FPGA-SCRIPT-2014050650.txt[confirm]
Delete harddisk:/FPGA-SCRIPT-2014050657.txt[confirm]
Delete harddisk:/FPGA-SCRIPT-2014050649.txt[confirm]
Delete harddisk:/FPGA-SCRIPT-2014050604.txt[confirm]
Delete of harddisk:/FPGA-SCRIPT-2014050604.txt aborted!
%Error deleting /harddisk:/FPGA* : Interrupted function call
RP/0/RSP0/CPU0:ASR9001-A#
RP/0/RSP0/CPU0:ASR9001-A#delete harddisk:*FPGA*
Thu Jun 5 17:15:44.414 EST
Delete harddisk:/FPGA-SCRIPT-2014050604.txt[confirm]
Delete harddisk:/FPGA-SCRIPT-2014050626.txt[confirm]
Delete of harddisk:/FPGA-SCRIPT-2014050626.txt aborted!
%Error deleting /harddisk:/*FPGA* : Interrupted function call
RP/0/RSP0/CPU0:ASR9001-A#
Dir has the same behavior in Linux as well.
lab@XRhome:~$ mkdir foo
lab@XRhome:~$ mkdir foo1
lab@XRhome:~$ mkdir foo2
lab@XRhome:~$ echo "foo" > foo/foo.txt
lab@XRhome:~$ dir *foo*
foo:
foo.txt
foo1:
foo2:
lab@XRhome:~$
KSH utilities are not supported. If there is something in KSH that is needed then an enhancement request can be raised to have the command added to the XR CLI.
Using delete and rmdir commands is pretty rare. In order to remove old packages the install deactivate and install remove commands should be used. Not doing this is the same as simply deleting a program from c:\program files, it causes a breakage in the OS due to lingering files and could have some bad consequences. Also I should note that copying files to/from disk0 is not the best idea as your OS disk could get cluttered. Similar to how windows recommends an OS partition (or disk) and a data disk we do the same with the harddisk, and is where I would recommend to copy delete all files from.
Thanks,
Sam
06-05-2014 02:24 PM
Hi Evan,
I hope that I am able to address all of your concerns below.
If not let me know.
The rmdir command does not support wildcards in XR or Linux. Instead in linux you have to use more creative ways using command chaining. The same could be done in XR but I don't see any use cases for that. As well QNX, which we use as our kernel, does not support the -r or -f switches.
Delete seems to work fine for me.
RP/0/RSP0/CPU0:ASR9001-A#delete harddisk:/FPGA*
Thu Jun 5 17:15:14.590 EST
Delete harddisk:/FPGA-SCRIPT-2014050650.txt[confirm]
Delete harddisk:/FPGA-SCRIPT-2014050657.txt[confirm]
Delete harddisk:/FPGA-SCRIPT-2014050649.txt[confirm]
Delete harddisk:/FPGA-SCRIPT-2014050604.txt[confirm]
Delete of harddisk:/FPGA-SCRIPT-2014050604.txt aborted!
%Error deleting /harddisk:/FPGA* : Interrupted function call
RP/0/RSP0/CPU0:ASR9001-A#
RP/0/RSP0/CPU0:ASR9001-A#delete harddisk:*FPGA*
Thu Jun 5 17:15:44.414 EST
Delete harddisk:/FPGA-SCRIPT-2014050604.txt[confirm]
Delete harddisk:/FPGA-SCRIPT-2014050626.txt[confirm]
Delete of harddisk:/FPGA-SCRIPT-2014050626.txt aborted!
%Error deleting /harddisk:/*FPGA* : Interrupted function call
RP/0/RSP0/CPU0:ASR9001-A#
Dir has the same behavior in Linux as well.
lab@XRhome:~$ mkdir foo
lab@XRhome:~$ mkdir foo1
lab@XRhome:~$ mkdir foo2
lab@XRhome:~$ echo "foo" > foo/foo.txt
lab@XRhome:~$ dir *foo*
foo:
foo.txt
foo1:
foo2:
lab@XRhome:~$
KSH utilities are not supported. If there is something in KSH that is needed then an enhancement request can be raised to have the command added to the XR CLI.
Using delete and rmdir commands is pretty rare. In order to remove old packages the install deactivate and install remove commands should be used. Not doing this is the same as simply deleting a program from c:\program files, it causes a breakage in the OS due to lingering files and could have some bad consequences. Also I should note that copying files to/from disk0 is not the best idea as your OS disk could get cluttered. Similar to how windows recommends an OS partition (or disk) and a data disk we do the same with the harddisk, and is where I would recommend to copy delete all files from.
Thanks,
Sam
06-11-2014 10:52 AM
Thank you for the reply Sam, it helps.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide