How to make text after "read -p" bold?

I want to echo a text before the read with read -p. How can I make the text inside of the read -p bold? I don't want the user input to be bold. I just want the "content" part bold. Example: read -p "content:". content: should be bold. I tried tput...
more »

2017-03-18 19:03 (1) Answers

Checking sudo in Bash (script with if statements)

I've been working with bash for not more than 6 hours, and now I'm trying to create a menu that allows you to do some "fun" stuff :D. My problem is with the if statement that check if you're in sudo mode. I want to have 3 conditions: If I execute ...
more »

2017-03-18 15:03 (1) Answers

compare time in bash script with ± x min

I'm newbie in bash and need some advice. I have a .txt file with a time stamp inside that is reloaded every x time, and each time stamps the current date and time. "20221218-0841" Now i have build a bash script to check the content and give me an...
more »

2017-03-18 09:03 (2) Answers

Git Command Does not Work in Windows CMD

I am trying the below command in Windows CMD for Bitnami Gitlab VM machine at Windows 10. git clone git@192.168.1.10:user/project.git It works in Git Bash but the same command does not work for Windows CMD. I suspect when used in Windows CMD ssh ...
more »

2017-03-18 00:03 (2) Answers

Convert a String to a Number Only

I read in two numbers from a user but the number is a string. #!/bin/bash read -p "Enter first number: " num1 read -p "Enter second number: " num2 I know you can use the the "expr" or "bc" command to automatically convert the string to a number th...
more »

2017-03-17 16:03 (0) Answers

Accidentally moved several files into one file

I sometimes use bash under Windows 10 to move files with find. I wanted to move some files into a new folder. Every file is in it's own subfolder and I wanted to move all of these certain files into one new, so I ran this command: find -type f -path...
more »

2017-03-16 20:03 (0) Answers

Linux Script Command With PS1 Change

Saw one post here: Change PS1 after running the 'script' command but it didn't seem to answer the question. I am trying to have a script run the "script" command and also change the prompt (PS1) to indicate that the shell is now scripted. B...
more »

2017-03-16 15:03 (3) Answers

sed to find and replace a value in xml file

I have to run with sed for this job, without knowing the value (xxx), but only the attribute (revision) <types name="foo" revision="xxx"> to <types name="foo" revision="5678"> my first try is: sed 's@(revision=\").*@\1$5678\">@...
more »

2017-03-16 13:03 (2) Answers

-bash: !/usr/bin/env: event not found

I got this strange error message trying to write shebang to a python script: $ echo "#!/usr/bin/env python" > scripts/sandbox.py -bash: !/usr/bin/env: event not found $ echo "say what?" > scripts/sandbox.py Immediately, doing the same thin...
more »

2017-03-15 00:03 (1) Answers

Passing variable from bash to XQuery

I have a bash-script, that traverses through multiple directories and parses data from a few XML files. I am using XQilla to execute my XQueries. echo "---|Reading names|---" ../../xqilla .._name.fcs >> /var/lib/mysql-files/name.txt And this...
more »

2017-03-13 21:03 (1) Answers

utl file frename (mv) doesn't work - 29292

I have a a shared sftp directory mounted \xx.xx.xx.xx\SFTP_AX\ /sftp/ cifs user,uid=54321,gid=54321,suid,username=user,password=pass,workgroup=application,file_mode=0775,dir_mode=0775,rw 0 0 Then a PL/SQL that moves my file to another moun...
more »

2017-03-13 14:03 (0) Answers

Can't install gems with rbenv on Windows bash

I've searched far and wide for a question, a blog, anything that can solve this particular error, but I can't find it. Basically, running bash (well, zsh) on Windows 10. I installed rbenv and ruby build through their respective git repos. I set up a...
more »

2017-03-10 17:03 (0) Answers

Using -exec on output from bashrc function

In Cygwin, I wrote a bashrc function rg, which is basically a recursive grep statement: rg () { find . -type f -exec grep -il $1 {} \; } This works well, but now I need to run an additional grep on each output line to check for another word. I...
more »

2017-03-10 15:03 (1) Answers

Bash | pipe to bash function

In the attempt to pipe to a Bash function, I wrote this: example () { if [ -z ${1+x} ]; then local S=${@:-$(</dev/stdin)}; else local S="$1"; fi #echo "$S" echo "$S" | tr ' ' '_' } echo 'Moizès Júnior' | example example 'Moizès Jú...
more »

2017-03-10 14:03 (2) Answers

Shell Script Disk Image Analysis

I’m a beginner programmer and I'm try to learn how to successfully mount a disk image and analyse it but can't fine any guides online or any mention on web pages. I’ve set myself the task as I’m thinking of joining a computer forensics course n...
more »

2017-03-10 11:03 (1) Answers

bash script for kill PID from pgrep grunt

I'm an allstar noob to bash scripting. My script looks something like this: #!/bin/bash pgrep grunt > target.txt for i in target.txt do kill $i echo "killed $i" done Now, obviously it did not worked and i don't know how to make it...
more »

2017-03-09 14:03 (3) Answers