Open a text file with a dot in the file path - vim

Is this even possible? I am trying to script this install of IBM Clearcase and the path to it is like:
../disk1/InstallerImage_linux_gtk.x86/install.xml
The script barfs at the .x86 and it says "No such file or directory."
So I tried to just do vim ../disk1/InstallerImage_linux_gtk.x86/install.xml in a terminal and it opens the .x86 like a folder and allows you to select a file to edit instead of opening it directly.
Is there a way around this? Would the only way be to rename the folder before, do the sed voodoo and then move it back with the . in the name?
I guess I missed the obvious. I guess I could cd to the directory first and then do sed -i '' install.xml.
More info:
RHEL 6.5
Bash Script

You need to script a silent ClearCase installation, using one of the sample response files for Rational ClearCase.
That would avoid the need to open any file in vim.
See "Installing silently", which involves the following steps:
Run a silent install of Installation Manager using the Installation Manager installer.
Obtain a copy of the product response file and update it for your environment. If you want to record a response file using Installation Manager, see the Installation Manager information center for instructions.
Run a silent install of the Rational product using the Installation Manager.

I think you have created a file with a seriously strange file name. Do this:
$ cd /path/to/where/you/run/the/script/from
$ file ..
$ file ../disk1
$ file ../disk1/InstallerImage_linux_gtk.x86
$ file ../disk1/InstallerImage_linux_gtk.x86/install.xml
Every component of the relative path (beginning with "..") must be a directory. Only the final line should claim to be an ordinary file.

Related

Failing to install Sublime Text 3 in Ubuntu 16.04 using apt-get command

I had downloaded sublime previously directly from the browser as tarball and saved it in a folder (and of course extracted it).But this way I wasn't able to make Sublime my default editor and it didn't feature as an application when I tried to open a text file with a right-click.I read somewhere installing sublime text 3 using commands:
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer
will solve my problem. So I directly deleted the Sublime_text3 folder saved in my Downloads directory and then used the given commands. But when I entered the 3rd command line I got the following error(just writing the error part):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:/var/cache/apt/archives/sublime-text-installer_3126-2~webupd8~1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Can anyone explain why this error is coming and suggest a way to solve this problem? Also if anyone can tell how I can set Sublime as my default text editor from the tarball downloaded from the sublime text 3 website. Thanks in advance!
you can try this command to install Sublime Text using Snap Store..
sudo snap install sublime-text --classic
I'm not sure overall how to fix that error or what's going on (I use Slackware and not Ubuntu/Debian), but for a long while there have been official Sublime repositories several different Linux distributions, including Ubuntu/Debian.
It's highly recommended that you use those if you want to go the package route and not use existing solutions such as the one referenced in your question or in the other response here, if for no other reason than only the official repository is guaranteed to contain an unmodified version of Sublime. Additionally the official repositories are always updated on release, which may or may not happen in a timely manner in other repositories.
The links referenced above contain instructions on how to set up and use Sublime from those repositories, and if you have any issues a good place to ask is the forum.
One thing to note which isn't mentioned explicitly in the above pages is that to use the official repositories, you should:
Choose only one of them (stable or dev, noting that you need a license to run a dev version) and not add both repositories or things will not work as expected
Ensure that other repositories that you've added (such as the one in your question) are removed to make sure that the package system definitely pulls the correct package
There are a couple of ways to go if you want to install Sublime from the tarball version. The easiest way would be to extract it, then manually set up launcher shortcuts and so on based on what falls out. How exactly you would register it as a text editor in that case, I'm not entirely sure since I don't use the same distribution as you.
Presuming that the process would be easier if Sublime was installed in a way similar to how the package manager would do it, the tarball comes with a desktop file and icons, so the following steps can be used to (presumably) do what the package installer would do.
The proviso here is that although these steps work on my non-Ubuntu machine, I don't know if all of the referenced tools are installed by default on an Ubuntu system, so so more setup work may be involved.
Note also that the files in the tarball are not entirely self-consistent, which makes this a little bit more work.
First, you need to extract the tarball (replace tarball filename as appropriate for location and build):
cd /opt
sudo tar xvf ~/Downloads/sublime_text_3_build_3176_x64.tar.bz2
This creates the folder /opt/sublime_text_3/ and fills it with the contents of the tarball.
Next, you want to install the icons contained in the tarball. As far as I have been able to tell, the icons in the tarball aren't in the correct directory structure, requiring each to be copied into place individually. We also need to update the icon cache to ensure that the new icon is noticed by the system:
cd /usr/share/icons/hicolor/
sudo cp /opt/sublime_text_3/Icon/16x16/sublime-text.png 16x16/apps/
sudo cp /opt/sublime_text_3/Icon/32x32/sublime-text.png 32x32/apps/
sudo cp /opt/sublime_text_3/Icon/48x48/sublime-text.png 48x48/apps/
sudo cp /opt/sublime_text_3/Icon/128x128/sublime-text.png 128x128/apps/
sudo cp /opt/sublime_text_3/Icon/256x256/sublime-text.png 256x256/apps/
sudo gtk-update-icon-cache -f -t .
Now we want to install the sublime_text.desktop file that is in the tarball. Note however that like the icons, it seems kind of broken; the tarball extracts to sublime_text_3 but the desktop file assumes that the application is actually in /opt/sublime_text instead.
As such, you either need to rename the folder that was extracted to sublime_text to match what is in the desktop file, or edit the desktop file to make the path correct.
The following steps assume that we want to keep the folder the same and rewrite the desktop file. These commands will generate a new file named sublime_text_3.desktop with the changes.
cd /opt/sublime_text_3/
sed -e "s^/sublime_text/^/sublime_text_3/^" sublime_text.desktop | sudo tee sublime_text_3.desktop
Now you can install the desktop file. You do that with desktop-file-install, passing it the name of the desktop file. For accessing Sublime from the command line, you also want to set up a subl link to the installed copy of Sublime.
Adjust the paths as appropriate here if you decided to rename the folder instead of editing the desktop file:
sudo desktop-file-install sublime_text_3.desktop --rebuild-mime-info-cache
sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/subl
At this point Sublime should show up as an installed application, or at least it does in my Window Manager; if not, executing sudo update-desktop-database may help refresh it.
You can try this once. i hope it will help
wget https://download.sublimetext.com/files/sublime-text_build-4126_amd64.deb
sudo dpkg -i sublime-text_build-4126_amd64.deb

I cannot Uninstall Tcl from my linux system

I installed tcl to learn it, however, I installed all the files in the wrong location. I am trying to uninstall it, But the uninstall file does not work. I am trying to carry out the instructions form their website:
To uninstall ActiveTcl, run the "uninstall.tcl" script that is located in the directory where you extracted the ActiveTcl archive. Note that you must use the "wish" in the distribution you wish to uninstall. For example:
% /path/Tcl/bin/wish /path/Tcl/lib/ppm/log/ActiveTcl/uninstall_ActiveTcl.tcl
stored, by default, in the directory /lib/ppm/log/ActiveTcl. You must use the wish interpreter from the distribution you wish to uninstall. Ensure that you do not run the uninstall script from a directory that will be removed during the uninstallation.
For example:
% /path/Tcl/bin/wish /path/Tcl/lib/ppm/log/ActiveTcl/uninstall_ActiveTcl.tcl
Note: if you are uninstalling both ActiveTcl and Tcl Dev Kit, uninstall Tcl Dev Kit before uninstalling ActiveTcl.
There is no uninstall_ActiveTcl.tcl. I do see an "uninstall" file but it does not have an extension, and I do not know how to run it.
Any help is appreciated
Thank you
Try editing the file to a uninstall.tcl file and see if that works. Take a back-up first though. Because we might need that file later
I re-installed it in a new location, compared the files that were installed between the old and the new location and deleted the file sin the old location. Unfortunately I could not delete many of the hidden files, as I did not know if they were there originally or if they belonged to Tcl. I am really surprised and disappointed there is no easy way to uninstall tcl properly.
I strongly suspect that you should uninstall ActiveTcl as follows:
Open a command prompt
Change directory to where you found the install file - e.g.
$ cd path_to_Tcl_installation/bin
Run the file
$ ./uninstall
On linux systems, you don't need any particular file extension in order to be able to run a file.
I don't know CentOS but a little googling led me to a forum thread that describes how to open a command prompt.
Good luck

Installshield Silent Install Log

I've been given a silent install from a 3rd party (made with Installshield) I need to include as part of the project I am working on at the moment.
I've got it all working right up until I burn it to a DVD and attempt the install.
Installshield in silent install mode writes a log file to the same directory as setup.exe. Being on a DVD this is a read only folder.
I see I can change the default location of the log file using a command line switch, but is there a way to make it not create one at all?
I struck the same problem. I tried:
Setup.exe /s /f2null
And I couldn't find a log file anywhere afterwards...
For each setup.exe that build by installsheild, you can use f2"logpath" parameter to specify the log file in your own script.
If 3rd party "setup.exe" creates a log automatically - the easiest solution it redirect this log to %temp% directory.

How to install packages in Tcl?

I am trying to install critlib on my machine (http://equi4.com/critlib/), so that I can create zip files dynamically in Tcl.
The issue is that I have no idea how to install Tcl packages. Is there a certain place you put the folders? Is there a command like yum I can use?
I've skimmed the various Tcl beginners guides and read the sections about packages, but every source always seems to be assuming knowledge I lack.
Yes, there are some directories. To list them, execute tclsh and enter
join $auto_path \n
In each of that directory and its subdir (but not the sub-sub-dir) tcl looks for a file called pkgIndex.tcl.
So if you got an archive, extract it, look where the pkgIndex.tcl is, and copy the directory where this file is in to one of the paths $auto_path. The problem is only to select the appropiate path from the output of step 1.
If you are not sure what the appropiate directory is, I suggest editing the output from the first step into your question.
If you are using vscode and made virtual environment then you can do it as follows
"pipenv install tcl"

How to create Windows compatible rar sfx archive on Linux

I want to create a rar SFX archive that can be executed on Windows, using Linux. Suppose I want to put in the archive the file myprog.exe and automatically execute the file when the archive is extracted.
I've created a init script (myinit.txt)
;The comment below contains SFX script commands
Path=%TEMP%
Setup=tftpd32.exe
TempMode
Silent=1
Overwrite=1
Then I created the archive with the following commands:
rar a -sfx archive.exe myprog.exe
rar c archive.exe < myinit.txt
Now if I open archive.exe with Winrar I can see my file and all the Option I set correctly. The problem is that if I try to execute the file (with double click) I get an error:
program too bit to fit in memory
I suppose the problem is that the file doesn't have the layout of a Windows executable.
Searching around I found that zip has an option -A that can be used to fix this problem. Is there a way to to that with rar?
Found the solution! The problem was clearly the sfx module. I searched in WinRAR program files in my Windows machine and found the Windows Default.SFX. I copied that file on my linux machine in the same directory in which I was creating the archive, renaming it to windows.sfx. At this point I run:
> rar a -sfxwindows.sfx archive.exe myprog.exe
> rar c archive.exe < myinit.txt
and it worked!
Just another tip: the file myinit.txt must be written using the Windows newline convention.
Only one thing is still missing: the possibility to set an icon for the archive. Windows documentation show a -iicon option that is missing in the linux doc.
That should work:
rar a -sfxdefault.sfx myexeforwindows.exe myprog.exe

Resources