I want write my own alias called oepnserver. The functions of the oepnserver are: show my ip address use python module to start a server on current folder. The detailed code is listed below: When I type oepnserver, my terminal only shows: However, my expectation was I also try to use the ifconfig wlan0 |grep inet |awk ‘{print $2}’ along,
Tag: bash
find and copy command not working in bash
This line works in the terminal, but not in a bash script: cd /home/me/Downloads/Data/$currentYear/$currentMonth/$currentDay/ find . -name ‘*.wav’ -exec cp {} $tempfolder ; I’m trying to copy all the WAVE files from all the sub-directories to a temporary folder Answer So, I solved it. Turns out, that the cd /home/me/Downloads/Data/$currentYear/$currentMonth/$currentDay/ was not actually changing the directory for the find .
install python packages using init scripts in a databricks cluster
I have installed the databricks cli tool by running the following command pip install databricks-cli using the appropriate version of pip for your Python installation. If you are using Python 3, run pip3. Then by creating a PAT (personal-access token in Databricks) I run the following .sh bash script: python_dependencies.sh script I use the above script to install python libraries
ftp: Login to server, auto-change remote dir, then bring user input?
I’m using “ftp” with the login credentials in .netrc for auto-login to a remote FTP server. The thing is that I always need to “cd” to my remote working dir manually each time I log in. Is there any way to “cd” automatically on connection, and then bring the user input after the directory was changed? Answer The solution is
find files modified within given time range
Hello to everyone I’m trying to create a script to search files that modified between X:00-X:59. X is given by the user. I’ve tried this: Any solutions? Answer -newermt primary doesn’t accept a time range in any format. To select files modified within let’s say the period A-B, you need two -newermts; one to include files newer than A, the
How can I ingore whitespaces inside an echo command when usual methods don’t seem to work
Hi I’m pretty new to linux/bash in general and I’m having a some trouble making a script for my coworker. Idea of this script is to help automate coworkers IP table entries (don’t use IP tables myself so no idea how it works, just working as per his instructions). Program is going to ask a few questions, form an entry
Ubuntu initial configuration script errors
I’m newbie to linux and I’m trying to make an initial configuration script for basic users passwords, SSH rules and system config of Hostname & timezone as below, But I’m getting below errors, I couldn’t figure it out. Anyone could help me plz Thanks, Answer I’ve found this out after long search. The problem is, executing the script with root
making a Hotel management system in BashScript
I am unable to correct the error. I have tried searching on Google but i can’t figure out what my output is referring to. Its giving a line number but the code is right there. “fi” is used at the end of IF statements in scriptfiles. This is my code I am attaching the output too Error while running the
How to create a shell script which can create a .java file on executing?
The requirement is to create a shell script that can create a FileName.java file where FileName would be the parameter passed to the script while running the script. Example: On executing the above command, a file Sample.java should get created with content: If sources for learning bash scripting is added in the answer it would be very helpful. Answer Here-docs
Shell script to replace all spaces in only the column headers to underscore in a csv file
I am trying to just replace the spaces in the column headers only with underscores(_). this is my sample data Input Output My sample code is something like this, sorry its very rough! Answer Unless your example is too simplistic, you just have to change all spaces to underscores in line 1