How can I use launch4j to wrap a GUI application that also provides a command line interface?

Bash
I am developing a Java application, which is mainly a GUI application. However, it also provides a command line interface. I can divide the command li...
5 years ago

get the first 5 characters from each line in shell script

Bash
Here is my sample.txt file it contains following 31113 70:54:D2 - a-31003 31114 70:54:D2 - b-31304 31111 4C:72:B9 - c-31303 31112 4C:72:B...
5 years ago

Trying to pass user input into a simple shell that I am creating

Bash
I am creating a simple shell. User enters a system call, I fork and call execvp on the child process for whatever command the user entered. I debugged...
5 years ago

Get the extension of file

Bash
I have files with "multiple" extension , for better manipulation I would like to create new folder for each last extension but first I need to retriev...
5 years ago

Check exit code of a program called in a while loop

Bash
I would like to write a loop in bash which executes until a certain command stops failing (returning non-zero exit code), like so: while ! my_command...
5 years ago

How would I chown everything found by grep

Bash
I am looking to chown all files that contain the word "hi" I currently have grep -r $1 $2 if [ $? -eq 0 ]; then echo "Found text" ec...
5 years ago

Grep to find a file that contains a string in a directory

Bash
I'm trying to get familiar with the basics of the terminal. I'd like to find the file within my CMS website that contains my Google Analytics tracking...
5 years ago

Shell script help for reading in file

Bash
I have an assignment where I am reading in a file, here is my code #Reads in file while read line; do echo `wc -l` "is the number of students in the ...
5 years ago

Check folder size in bash

Bash
I'm trying to write a script that will calculate a directory size and if the size is less than 10GB, and greater then 2GB do some action.where do i n...
5 years ago

How to execute a shell script on a remote server using Ansible?

Bash
I am planning to execute a shell script on a remote server using Ansible playbook. test.sh: touch test.txt Playbook: --- - name: Transfer and exe...
5 years ago

How to create array with single quotes in Bash?

Bash
I have this list/array: declare -a LISTNODES=('servername node="{'region': 'primary', 'zone': 'east'}"' 'servername node="{'region': 'primary', 'zone...
5 years ago

How to output the sips image in directory

Bash
sips --resampleWidth 300 --out ./changedPic/A.png ./Normal/A.png I did this command in shell. however it didn't make the A.png under changedPic di...
5 years ago

Expansion of variable inside single quotes in a command in bash shell script

Bash
I want to run a command from a bash shell script which has single quotes and some other commands inside the single quotes and a variable. e.g. repo f...
5 years ago

How do I tell what type my shell is

Bash
How can I tell what type my shell is? ie, whether it's traditional sh, bash, ksh, csh, zsh etc. Note that checking $SHELL or $0 won't work because $...
5 years ago

Environment variable does not work inside command

Bash
I'm stuck for houres on this strange issue. I have a bashscript which is executing the following: TEST="12.x.x.x" echo ${TEST} gave me 12.x.x.x So...
5 years ago

Does bash have a way to un-export a variable without unsetting it?

Bash
Is it possible to export a variable in Bash, then later un-export it, without unsetting it entirely? I.e. have it still available to the current shell...
5 years ago

prevent "dotting" a shell to execute it ( exit in a function killing the terminal vs exiting the shell )

Bash
If launching a script with an exit statement in it, you have to launch it as a child If you launch it inside the current shell of started with your t...
5 years ago

Replace NULL string pattern with blank

Bash
I have a pipe delimiter file in which i need to replace NULL string with blank. file is very huge around 9 GB and contain 2 million records and has 15...
5 years ago

How can I force PHP Version for Command Line?

Bash
I am hosted with 1and1.com, and I have setup my files to be parsed with php5 using .htaccess. But that only works in apache, and not in command line,...
5 years ago

How do I assign ls to an array in Linux Bash?

Bash
array=${ls -d */} echo ${array[@]} I have three directories: ww ee qq. I want them in an array and then print the array. ...
5 years ago