New answers tagged

0

Add the new PATH to your ~/.bashrc by: echo 'export PATH=/home/thebigfootsdad/Downloads/swift-3.0-preview-1-ubuntu15.10/usr/bin:"${PATH}"' >>~/.bashrc Or use your favorite editor to edit ~/.bashrc and add the following at the end: export PATH=/home/thebigfootsdad/Downloads/swift-3.0-preview-1-ubuntu15.10/usr/bin:"${PATH}"


0

Remind to make a backup of the application folder before changing around things, and that you need to restart to make the new $PATH setting take effect. Ive written this answer based on the sparse information given and it might or might not work You can move that installation probably into the /opt/ directory and then adding it to the path variable. The ...


1

Bash: same as Marek's with sourcing a file with user's values, with the caveat that this file can do anything, and typos will just elicit syntax errors, so this requires a bit of user know-how. You can parse command line parameters with getopts. Python: see the argparse module to parse command line parameters, and ConfigParser(v2) and configparser(v3) to ...


3

Since you mention python, a python answer: if you simply want to set a default value for an argument, you can simply set the default for the function: def show(val = 30): print(val) # to print the default value (30) show() # to show another value (e.g. 40) show(40) In other words, this will print the default value if you give no argument, while it ...


2

Script file: #!/bin/bash # set default values X=10 Y="lorem ipsum" source ~/.myscript.conf echo "X = $X, Y = $Y" .myscript.conf file: X=20 Y="something else" Now, if a user runs script file and does not have .myscript.conf file in his home directory, script will use X=10 and Y="lorem ipsum", if there is config file, it will use values from the file. ...



Top 50 recent answers are included