Skip to content

Tag: shell

Non-dash related bad substitution error

I am trying to write a bash script performing to find and pull somewhere else a specific file type. So far, I came up with the following script: find ./to_compress -type f -iname “*.tar” -mindepth 1 -maxdepth 1 -exec mv {} ./compressed/${{}##*/} However the bash complains that ${{}##*/} is a bad s…

Extract fields from a custom xml

Im making a script to extract fields from a XML, now i got this and i need to make it work, i was trying with 2 for and greps and i need a little help with this i got this xml withs this fields and i want a output like this for make more comparations: Answer there are many issues

Simulate permissions for non-login user

I want to perform some actions on behalf of some non-login users, such as e.g. www-data or uwsgi. My purpose is to test some permissions, check what dirs they can modify etc etc. Is there a recommended way of going about this, other than creating a shell and password for them and su ? edit: When I try to su

get user input in awk script and update it in file

I have a students.txt (RollNo, Name, IDU, CGPA), If Roll number exists prompt the user to change the IDU and CGPA and update the same in the file named “Student.txt” I made the following script: now I need help in taking user input for IDU and CGPA values and update the students.text file with that values aga…