Skip to content

Bash script to create PHPStorm shortcut and symbolic link in Ububtu

  • by

In this bash script file, the PHPSTORM_PATH variable is defined at the top of the script and is used to define the path to the PHPStorm binary ($PHPSTORM_PATH/bin/phpstorm.sh) and the path to the icon file ($PHPSTORM_PATH/bin/phpstorm.png). This makes it easy to change the path to the PHPStorm installation directory by simply changing the value of the PHPSTORM_PATH variable.

Just copy and paste the content to a new text file with an extension “.sh”. Make it executable

Dont forget to change the “/path/to/phpstorm” at line 4 with your onw path

#!/bin/bash

# Define the path to the PHPStorm binary
PHPSTORM_PATH=/path/to/phpstorm

# Define the path to the desktop file directory
DESKTOP_DIR=$HOME/.local/share/applications

# Define the PHPStorm binary
PHPSTORM_BIN=$PHPSTORM_PATH/bin/phpstorm.sh

# Define the path to the icon file
ICON_PATH=$PHPSTORM_PATH/bin/phpstorm.png

# Create the symbolic link
sudo ln -s $PHPSTORM_BIN /usr/local/bin/phpstorm

# Create the desktop file
echo "[Desktop Entry]
Name=PHPStorm
Comment=PHP IDE
Exec=$PHPSTORM_BIN
Icon=$ICON_PATH
Terminal=false
Type=Application
Categories=Development;" > $DESKTOP_DIR/phpstorm.desktop

# Set the permissions for the desktop file
chmod +x $DESKTOP_DIR/phpstorm.desktop

echo "Done."

Note: Please check the quotes when you paste the script so the content is imported correctly.

Hits: 6

Leave a Reply

Your email address will not be published. Required fields are marked *